use of java.awt.TextArea in project Smack by igniterealtime.
the class JMFInit method createGUI.
private void createGUI() {
TextArea textBox = new TextArea(5, 50);
add("Center", textBox);
textBox.setEditable(false);
addNotify();
pack();
int scrWidth = (int) Toolkit.getDefaultToolkit().getScreenSize().getWidth();
int scrHeight = (int) Toolkit.getDefaultToolkit().getScreenSize().getHeight();
setLocation((scrWidth - getWidth()) / 2, (scrHeight - getHeight()) / 2);
setVisible(visible);
}
use of java.awt.TextArea in project jdk8u_jdk by JetBrains.
the class bug7129742 method main.
public static void main(String[] args) throws Exception {
SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
frame = new JFrame("Test");
TextArea textArea = new TextArea("Non-editable textArea");
textArea.setEditable(false);
frame.setLayout(new FlowLayout());
frame.add(textArea);
frame.pack();
frame.setVisible(true);
try {
Class XTextAreaPeerClzz = textArea.getPeer().getClass();
System.out.println(XTextAreaPeerClzz.getName());
if (!XTextAreaPeerClzz.getName().equals("sun.awt.X11.XTextAreaPeer")) {
fastreturn = true;
return;
}
Field jtextField = XTextAreaPeerClzz.getDeclaredField("jtext");
jtextField.setAccessible(true);
JTextArea jtext = (JTextArea) jtextField.get(textArea.getPeer());
caret = (DefaultCaret) jtext.getCaret();
textArea.requestFocusInWindow();
} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
/* These exceptions mean the implementation of XTextAreaPeer is
* changed, this testcase is not valid any more, fix it or remove.
*/
frame.dispose();
throw new RuntimeException("This testcase is not valid any more!");
}
}
});
toolkit.realSync();
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
try {
if (fastreturn) {
return;
}
boolean passed = caret.isActive();
System.out.println("is caret visible : " + passed);
if (!passed) {
throw new RuntimeException("The test for bug 71297422 failed");
}
} finally {
frame.dispose();
}
}
});
}
use of java.awt.TextArea in project jdk8u_jdk by JetBrains.
the class TextAreaTwicePack method main.
public static void main(final String[] args) {
final Frame frame = new Frame();
final TextArea ta = new TextArea();
frame.add(ta);
frame.pack();
frame.setVisible(true);
sleep();
final Dimension before = frame.getSize();
frame.pack();
final Dimension after = frame.getSize();
if (!after.equals(before)) {
throw new RuntimeException("Expected size: " + before + ", actual size: " + after);
}
frame.dispose();
}
use of java.awt.TextArea in project jdk8u_jdk by JetBrains.
the class TestApplet method init.
public void init() {
final TextArea log = new TextArea("Events:\n");
log.setEditable(false);
log.setSize(400, 200);
this.add(log);
log.addKeyListener(new KeyAdapter() {
@Override
public void keyTyped(KeyEvent e) {
log.append("Key typed: char = " + e.getKeyChar() + "\n");
}
@Override
public void keyPressed(KeyEvent e) {
log.append("Key pressed: char = " + e.getKeyChar() + " code = " + e.getKeyCode() + "\n");
}
@Override
public void keyReleased(KeyEvent e) {
log.append("Key released: char = " + e.getKeyChar() + " code = " + e.getKeyCode() + "\n");
}
});
}
use of java.awt.TextArea in project voltdb by VoltDB.
the class DatabaseManager method initGUI.
private void initGUI() {
Panel pQuery = new Panel();
Panel pCommand = new Panel();
pResult = new Panel();
pQuery.setLayout(new BorderLayout());
pCommand.setLayout(new BorderLayout());
pResult.setLayout(new BorderLayout());
Font fFont = new Font("Dialog", Font.PLAIN, 12);
txtCommand = new TextArea(5, 40);
txtCommand.addKeyListener(this);
txtResult = new TextArea(20, 40);
txtCommand.setFont(fFont);
txtResult.setFont(new Font("Courier", Font.PLAIN, 12));
butExecute = new Button("Execute");
butClear = new Button("Clear");
butExecute.addActionListener(this);
butClear.addActionListener(this);
pCommand.add("East", butExecute);
pCommand.add("West", butClear);
pCommand.add("Center", txtCommand);
gResult = new Grid();
setLayout(new BorderLayout());
pResult.add("Center", gResult);
pQuery.add("North", pCommand);
pQuery.add("Center", pResult);
fMain.add("Center", pQuery);
tTree = new Tree();
// (ulrivo): screen with less than 640 width
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
if (d.width >= 640) {
tTree.setMinimumSize(new Dimension(200, 100));
} else {
tTree.setMinimumSize(new Dimension(80, 100));
}
gResult.setMinimumSize(new Dimension(200, 300));
fMain.add("West", tTree);
doLayout();
fMain.pack();
}
Aggregations