use of java.awt.Panel in project voltdb by VoltDB.
the class ZaurusEditor method initGUI.
private void initGUI() {
// without connection there are no tables
// vAllTables is a local variable with all table names in the database
// vHoldTableNames holds the table names which have a ZaurusTableForm
Vector vAllTables = getAllTables();
if (vAllTables == null) {
return;
}
// initialize a new list for the table names which have a form in pForm
vHoldTableNames = new Vector(20);
vHoldForms = new Vector(20);
// this holds the card panel pForm for the forms in the top
// a card panel pButton below
// the both card panels form a panel which is centered in this
// and a status line in the south
this.setLayout(new BorderLayout(3, 3));
// >>> the top of this: the entry forms in pForm
// pFormButs holds in the center the forms card panel pForm and
// in the south the button card panel pButton
Panel pFormButs = new Panel();
pFormButs.setLayout(new BorderLayout(3, 3));
pForm = new Panel();
lForm = new CardLayout(2, 2);
pForm.setLayout(lForm);
// the search panel containing the list of all tables and
// the entry fields for search words in the Center
Panel pEntry = new Panel();
pEntry.setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.HORIZONTAL;
c.insets = new Insets(3, 3, 3, 3);
c.gridwidth = 1;
c.gridheight = 1;
c.weightx = c.weighty = 1;
c.anchor = GridBagConstraints.WEST;
c.gridy = 0;
c.gridx = 0;
pEntry.add(new Label("Search table"), c);
c.gridx = 1;
// get all table names and show a drop down list of them in cTables
cTables = new Choice();
for (Enumeration e = vAllTables.elements(); e.hasMoreElements(); ) {
cTables.addItem((String) e.nextElement());
}
c.gridwidth = 2;
pEntry.add(cTables, c);
c.gridy = 1;
c.gridx = 0;
c.gridwidth = 1;
pEntry.add(new Label("Search words"), c);
c.gridx = 1;
c.gridwidth = 2;
fSearchWords = new TextField(8);
pEntry.add(fSearchWords, c);
// use search words
c.gridwidth = 1;
c.gridy = 2;
c.gridx = 0;
pEntry.add(new Label("Use search words"), c);
gAllWords = new CheckboxGroup();
Checkbox[] checkboxes = new Checkbox[2];
checkboxes[0] = new Checkbox("all", gAllWords, true);
c.gridx = 1;
pEntry.add(checkboxes[0], c);
checkboxes[1] = new Checkbox("any ", gAllWords, false);
c.gridx = 2;
pEntry.add(checkboxes[1], c);
// ignore case
c.gridy = 3;
c.gridx = 0;
pEntry.add(new Label("Ignore case"), c);
gIgnoreCase = new CheckboxGroup();
Checkbox[] checkboxes1 = new Checkbox[2];
checkboxes1[0] = new Checkbox("yes", gIgnoreCase, true);
c.gridx = 1;
pEntry.add(checkboxes1[0], c);
checkboxes1[1] = new Checkbox("no", gIgnoreCase, false);
c.gridx = 2;
pEntry.add(checkboxes1[1], c);
// Match column exactly
c.gridy = 4;
c.gridx = 0;
pEntry.add(new Label("Match whole col"), c);
gNoMatchWhole = new CheckboxGroup();
Checkbox[] checkboxes2 = new Checkbox[2];
checkboxes2[0] = new Checkbox("no", gNoMatchWhole, true);
c.gridx = 1;
pEntry.add(checkboxes2[0], c);
checkboxes2[1] = new Checkbox("yes ", gNoMatchWhole, false);
c.gridx = 2;
pEntry.add(checkboxes2[1], c);
pForm.add("search", pEntry);
pFormButs.add("Center", pForm);
// the buttons
this.initButtons();
pButton = new Panel();
lButton = new CardLayout(2, 2);
pButton.setLayout(lButton);
pButton.add("search", pSearchButs);
pButton.add("edit", pEditButs);
pButton.add("insert", pInsertButs);
pFormButs.add("South", pButton);
this.add("Center", pFormButs);
// >>> the South: status line at the bottom
Font fFont = new Font("Dialog", Font.PLAIN, 10);
ZaurusEditor.tStatus = new TextField("");
ZaurusEditor.tStatus.setEditable(false);
this.add("South", ZaurusEditor.tStatus);
}
use of java.awt.Panel in project voltdb by VoltDB.
the class ZaurusDatabaseManager method initGUI.
/**
* Method declaration
*
*/
private void initGUI() {
Panel pQuery = new Panel();
Panel pCommand = new Panel();
// define a Panel pCard which takes four different cards/views:
// tree of tables, command SQL text area, result window and an editor/input form
pCard = new Panel();
layoutCard = new CardLayout(2, 2);
pCard.setLayout(layoutCard);
// four buttons at the top to quickly switch between the four views
butTree = new Button("Tree");
butCommand = new Button("Command");
butResult = new Button("Result");
butEditor = new Button("Editor");
butTree.addActionListener(this);
butCommand.addActionListener(this);
butResult.addActionListener(this);
butEditor.addActionListener(this);
Panel pButtons = new Panel();
pButtons.setLayout(new GridLayout(1, 4, 8, 8));
pButtons.add(butTree);
pButtons.add(butCommand);
pButtons.add(butResult);
pButtons.add(butEditor);
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");
butExecute.addActionListener(this);
pCommand.add("South", butExecute);
pCommand.add("Center", txtCommand);
gResult = new Grid();
setLayout(new BorderLayout());
pResult.add("Center", gResult);
tTree = new Tree();
tTree.setMinimumSize(new Dimension(200, 100));
gResult.setMinimumSize(new Dimension(200, 300));
eEditor = new ZaurusEditor();
pCard.add("tree", tTree);
pCard.add("command", pCommand);
pCard.add("result", pResult);
pCard.add("editor", eEditor);
fMain.add("Center", pCard);
fMain.add("North", pButtons);
doLayout();
fMain.pack();
}
use of java.awt.Panel in project voltdb by VoltDB.
the class ConnectionDialog method createBorderPanel.
protected static Panel createBorderPanel(Component center) {
Panel p = new Panel();
p.setBackground(SystemColor.control);
p.setLayout(new BorderLayout());
p.add("Center", center);
p.add("North", createLabel(""));
p.add("South", createLabel(""));
p.add("East", createLabel(""));
p.add("West", createLabel(""));
p.setBackground(SystemColor.control);
return p;
}
use of java.awt.Panel in project jdk8u_jdk by JetBrains.
the class MultimonFullscreenTest method actionPerformed.
public void actionPerformed(ActionEvent ae) {
GraphicsDevice dev = deviceMap.get(ae.getSource());
System.err.println("Setting FS on device:" + dev);
final Window fsWindow;
if (useFSWindow) {
fsWindow = new Window(this, dev.getDefaultConfiguration()) {
public void paint(Graphics g) {
renderDimensions(g, getBounds(), this.getGraphicsConfiguration());
}
};
} else if (useFSDialog) {
fsWindow = new Dialog((Frame) null, "FS Dialog on device " + dev, false, dev.getDefaultConfiguration());
fsWindow.add(new Component() {
public void paint(Graphics g) {
renderDimensions(g, getBounds(), this.getGraphicsConfiguration());
}
});
} else {
fsWindow = new Frame("FS Frame on device " + dev, dev.getDefaultConfiguration()) {
public void paint(Graphics g) {
renderDimensions(g, getBounds(), this.getGraphicsConfiguration());
}
};
if (addHWChildren) {
fsWindow.add("South", new Panel() {
public void paint(Graphics g) {
g.setColor(Color.red);
g.fillRect(0, 0, getWidth(), getHeight());
}
});
fsWindow.add("North", new Button("Button, sucka!"));
}
}
fsWindow.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() > 1) {
done = true;
fsWindow.dispose();
}
}
});
fsWindow.addWindowListener(new WindowHandler());
dev.setFullScreenWindow(fsWindow);
if (dmChange && dev.isDisplayChangeSupported()) {
DisplayMode[] dms = dev.getDisplayModes();
DisplayMode myDM = null;
for (DisplayMode dm : dms) {
if (dm.getWidth() == 800 && dm.getHeight() == 600 && (dm.getBitDepth() >= 16 || dm.getBitDepth() == DisplayMode.BIT_DEPTH_MULTI) && (dm.getRefreshRate() >= 60 || dm.getRefreshRate() == DisplayMode.REFRESH_RATE_UNKNOWN)) {
myDM = dm;
break;
}
}
if (myDM != null) {
System.err.println("Setting Display Mode: " + myDM.getWidth() + "x" + myDM.getHeight() + "x" + myDM.getBitDepth() + "@" + myDM.getRefreshRate() + "Hz on device" + dev);
dev.setDisplayMode(myDM);
} else {
System.err.println("Can't find suitable display mode.");
}
}
done = false;
if (runRenderLoop) {
Thread updateThread = new Thread(new Runnable() {
public void run() {
BufferStrategy bs = null;
if (useBS) {
fsWindow.createBufferStrategy(2);
bs = fsWindow.getBufferStrategy();
}
while (!done) {
if (useBS) {
Graphics g = bs.getDrawGraphics();
renderDimensions(g, fsWindow.getBounds(), fsWindow.getGraphicsConfiguration());
bs.show();
} else {
fsWindow.repaint();
}
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
}
if (useBS) {
bs.dispose();
}
}
});
updateThread.start();
}
}
use of java.awt.Panel in project jdk8u_jdk by JetBrains.
the class ControlCharacter method createAndShowGUI.
static void createAndShowGUI() {
frame = new Frame();
frame.setSize(300, 300);
Panel panel = new Panel() {
@Override
public void paint(Graphics g) {
super.paint(g);
lock.lock();
isPainted.signalAll();
lock.unlock();
}
};
panel.addKeyListener(new KeyListener());
frame.add(panel);
lock.lock();
frame.setVisible(true);
panel.requestFocusInWindow();
try {
isPainted.await();
} catch (InterruptedException e) {
throw new RuntimeException(e);
} finally {
lock.unlock();
}
}
Aggregations