Search in sources :

Example 1 with Panel

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);
}
Also used : CardLayout(java.awt.CardLayout) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) Choice(java.awt.Choice) Enumeration(java.util.Enumeration) GridBagLayout(java.awt.GridBagLayout) CheckboxGroup(java.awt.CheckboxGroup) Label(java.awt.Label) Font(java.awt.Font) Panel(java.awt.Panel) BorderLayout(java.awt.BorderLayout) Checkbox(java.awt.Checkbox) TextField(java.awt.TextField) Vector(java.util.Vector)

Example 2 with Panel

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();
}
Also used : Panel(java.awt.Panel) CardLayout(java.awt.CardLayout) GridLayout(java.awt.GridLayout) BorderLayout(java.awt.BorderLayout) Button(java.awt.Button) TextArea(java.awt.TextArea) Dimension(java.awt.Dimension) Font(java.awt.Font)

Example 3 with Panel

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;
}
Also used : Panel(java.awt.Panel) BorderLayout(java.awt.BorderLayout)

Example 4 with Panel

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();
    }
}
Also used : Window(java.awt.Window) Frame(java.awt.Frame) MouseEvent(java.awt.event.MouseEvent) BufferStrategy(java.awt.image.BufferStrategy) MouseAdapter(java.awt.event.MouseAdapter) Graphics(java.awt.Graphics) DisplayMode(java.awt.DisplayMode) Panel(java.awt.Panel) GraphicsDevice(java.awt.GraphicsDevice) Button(java.awt.Button) Dialog(java.awt.Dialog) Component(java.awt.Component)

Example 5 with Panel

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();
    }
}
Also used : Graphics(java.awt.Graphics) Panel(java.awt.Panel) Frame(java.awt.Frame)

Aggregations

Panel (java.awt.Panel)70 BorderLayout (java.awt.BorderLayout)26 Button (java.awt.Button)25 Label (java.awt.Label)25 Frame (java.awt.Frame)18 GridBagLayout (java.awt.GridBagLayout)17 TextField (java.awt.TextField)17 GridBagConstraints (java.awt.GridBagConstraints)16 JPanel (javax.swing.JPanel)14 Dimension (java.awt.Dimension)13 Insets (java.awt.Insets)10 Point (java.awt.Point)10 Choice (java.awt.Choice)9 FlowLayout (java.awt.FlowLayout)9 Graphics (java.awt.Graphics)9 Checkbox (java.awt.Checkbox)7 GridLayout (java.awt.GridLayout)7 Font (java.awt.Font)6 JButton (javax.swing.JButton)6 Component (java.awt.Component)5