Package java.awt

Examples of java.awt.Panel


  public static void main(String[] args) {
    Frame frame = new Frame("Tabs"); //$NON-NLS-1$
    frame.setLayout(new BorderLayout());

    Label l1 = new Label("Test label 1"); //$NON-NLS-1$
    Panel p1 = new Panel(new BorderLayout());
    p1.add(l1, BorderLayout.CENTER);

    Label l2 = new Label("Test label 2"); //$NON-NLS-1$
    Panel p2 = new Panel(new BorderLayout());
    p2.add(l2, BorderLayout.CENTER);

    Label l3 = new Label("Test label 3"); //$NON-NLS-1$
    Panel p3 = new Panel(new BorderLayout());
    p3.add(l3, BorderLayout.CENTER);

    Label l4 = new Label("Test label 4"); //$NON-NLS-1$
    Panel p4 = new Panel(new BorderLayout());
    p4.add(l4, BorderLayout.CENTER);

    TabbedPanel tabs = new TabbedPanel(TabbedPanel.TOP);
    tabs.add("Test Tab 1", p1); //$NON-NLS-1$
    tabs.add(Messages.getString("TabbedPanel.11"), p2); //$NON-NLS-1$
    tabs.add(Messages.getString("TabbedPanel.12"), p3); //$NON-NLS-1$
View Full Code Here


      gbc.weighty = 1.0;
      l.setFont(textFont);
      l.setHAlignStyle(textAlign);
      gbc.weightx = 1.0;
      if (image != null) {
        Panel pi = new Panel(new BorderLayout(4, 0));
        pi.setBackground(backgroundColor);
        pi.setForeground(foregroundColor);
        UIUtil.waitFor(image, this);
        ImageCanvas c = new ImageCanvas(image);
        c.setValign(Canvas.TOP_ALIGNMENT);
        pi.add(c, BorderLayout.WEST);
        pi.add(l, BorderLayout.CENTER);
        UIUtil.gridBagAdd(p, pi, gbc, GridBagConstraints.REMAINDER);
      } else {
        UIUtil.gridBagAdd(p, l, gbc, GridBagConstraints.REMAINDER);
      }
View Full Code Here

            public void actionPerformed(ActionEvent evt) {
                getAgent().disconnect();
            }
        });

        Panel main = new Panel(new BorderLayout());
        main.setBackground(Color.black);
       

        banner = UIUtil.loadImage(getClass(), "/images/banner-small.gif"); //$NON-NLS-1$
        idle = UIUtil.loadImage(getClass(), "/images/tray-idle.gif"); //$NON-NLS-1$       
        tx = UIUtil.loadImage(getClass(), "/images/tray-tx.gif"); //$NON-NLS-1$
        rx = UIUtil.loadImage(getClass(), "/images/tray-rx.gif"); //$NON-NLS-1$
        txrx = UIUtil.loadImage(getClass(), "/images/tray-txrx.gif"); //$NON-NLS-1$
        disconnected = UIUtil.loadImage(getClass(), "/images/tray-disconnecting.gif"); //$NON-NLS-1$

        UIUtil.waitFor(banner, main);
        UIUtil.waitFor(idle, main);
        UIUtil.waitFor(tx, main);
        UIUtil.waitFor(rx, main);
        UIUtil.waitFor(txrx, main);
        UIUtil.waitFor(disconnected, main);
       
        ImageCanvas bannerCanvas = new ImageCanvas(banner);
        bannerCanvas.setHalign(ImageCanvas.LEFT_ALIGNMENT);
        bannerCanvas.setBackground(Color.black);
        main.add(bannerCanvas, BorderLayout.CENTER);
       
        activityPanel = new ImageCanvas(idle);
        activityPanel.setSize(new Dimension(32, 32));
        activityPanel.setBorder(4);
       
        main.add(activityPanel, BorderLayout.EAST);

        menu = new MenuBar();
        menuLookup = new Hashtable();

        file = new Menu(Messages.getString("GUI.menu.file")); //$NON-NLS-1$
View Full Code Here

                }
            });
        }

        // add the message to the top of the dialog
        Panel top = new Panel(new FlowLayout(FlowLayout.CENTER, 1, 1));
        mess = new Label(message);
        top.add(mess);
        pbar.add("North", top); //$NON-NLS-1$

        // add the progress bar to the middle of the dialog
        Panel middle = new Panel(new FlowLayout(FlowLayout.CENTER, 1, 1));
        pbox = new ProgressBox(maxValue);
        middle.add(pbox);
        pbar.add("Center", middle); //$NON-NLS-1$

        // add the Cancel button to the bottom of the dialog (if allowCancel is
        // true)
        if (allowCancel) {
            Panel bottom = new Panel(new FlowLayout(FlowLayout.CENTER, 1, 1));
            cancel = new Button(Messages.getString("ProgressBar.cancel")); //$NON-NLS-1$
            cancel.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    // pbar.dispose();
                    shouldCancel = true;
                }
            });
            bottom.add(cancel);
            pbar.add("South", bottom); //$NON-NLS-1$
        }

        // display the ProgressBar dialog
        Dimension d = pbar.getToolkit().getScreenSize();
View Full Code Here

           
        });
        rebuildLookIn();

        // Create the tool bar
        Panel z = new Panel(new FlowLayout());
        if (showButtons) {
            home = new ImageButton(showButtonImages ? UIUtil.getStockImage(StockIcons.STOCK_HOME, AWTFileSelector.class) : null, showButtonText ? Messages.getString("AWTFileSelector.home") : null, "home"); //$NON-NLS-1$ //$NON-NLS-2$
            home.setHoverButton(true);
            home.addActionListener(this);
            home.setToolTipText(Messages.getString("AWTFileSelector.navigateToYourHomeDirectory")); //$NON-NLS-1$
            z.add(home);
            parent = new ImageButton(showButtonImages ? UIUtil.getStockImage(StockIcons.STOCK_UP_FOLDER, AWTFileSelector.class) : null, showButtonText ? Messages.getString("AWTFileSelector.home") : null, "home"); //$NON-NLS-1$ //$NON-NLS-2$
            parent.setHoverButton(true);
            parent.addActionListener(this);
            parent.setToolTipText(Messages.getString("AWTFileSelector.navigateToParent")); //$NON-NLS-1$
            z.add(parent);
            newFolder = new ImageButton(showButtonImages ? UIUtil.getStockImage(StockIcons.STOCK_NEW_FOLDER, AWTFileSelector.class) : null, showButtonText ? Messages.getString("AWTFileSelector.new") : null, "newFolder"); //$NON-NLS-1$ //$NON-NLS-2$
            newFolder.setHoverButton(true);
            newFolder.addActionListener(this);
            newFolder.setToolTipText(Messages.getString("AWTFileSelector.createFolder")); //$NON-NLS-1$
            z.add(newFolder);
            remove = new ImageButton(showButtonImages ? UIUtil.getStockImage(StockIcons.STOCK_DELETE, AWTFileSelector.class) : null, showButtonText ? Messages.getString("AWTFileSelector.delete") : null, "delete"); //$NON-NLS-1$ //$NON-NLS-2$
            remove.setHoverButton(true);
            remove.addActionListener(this);
            remove.setToolTipText(Messages.getString("AWTFileSelector.removeSelected")); //$NON-NLS-1$
            z.add(remove);
        }
        if (showHiddenFilesSwitch) {
            showHiddenFiles = new Checkbox(Messages.getString("AWTFileSelector.hiddentFiles"));             //$NON-NLS-1$
            showHiddenFiles.addItemListener(new ItemListener() {

                public void itemStateChanged(ItemEvent e) {
                    refresh();
                }
            });
        }

        // Create the top bar
        Panel top = new Panel(new GridBagLayout());
        GridBagConstraints gbc = new GridBagConstraints();
        gbc.fill = GridBagConstraints.HORIZONTAL;
        gbc.anchor = GridBagConstraints.WEST;
        gbc.weightx = 1.0;
        UIUtil.gridBagAdd(top, lookIn, gbc, GridBagConstraints.RELATIVE);
        gbc.weightx = 0.0;
        UIUtil.gridBagAdd(top, z, gbc, GridBagConstraints.REMAINDER);
       
        // Create the path panel
        Panel pathPanel = new Panel(new GridBagLayout());
        GridBagConstraints gbc1 = new GridBagConstraints();
        path = new TextField(""); //$NON-NLS-1$
        path.addActionListener(this);
        gbc1.fill = GridBagConstraints.HORIZONTAL;
        gbc1.anchor = GridBagConstraints.WEST;
View Full Code Here

        Font fFont = new Font("Dialog", Font.PLAIN, 12);

        setLayout(new BorderLayout());

        Panel p = new Panel();

        p.setBackground(SystemColor.control);
        p.setLayout(new GridLayout(16, 1));

        tSourceTable = new TextField();

        tSourceTable.setEnabled(false);

        tDestTable = new TextField();

        tDestTable.addActionListener(this);

        tDestDrop = new TextField();

        tDestDrop.addActionListener(this);

        tDestCreate = new TextField();

        tDestCreate.addActionListener(this);

        tDestDelete = new TextField();

        tDestDelete.addActionListener(this);

        tDestCreateIndex = new TextField();

        tDestCreateIndex.addActionListener(this);

        tDestDropIndex = new TextField();

        tDestDropIndex.addActionListener(this);

        tSourceSelect = new TextField();

        tSourceSelect.addActionListener(this);

        tDestInsert = new TextField();

        tDestInsert.addActionListener(this);

        tDestAlter = new TextField();

        tDestAlter.addActionListener(this);

        cTransfer = new Checkbox("Transfer to destination table", true);

        cTransfer.addItemListener(this);

        cDrop = new Checkbox("Drop destination table (ignore error)", true);

        cDrop.addItemListener(this);

        cCreate = new Checkbox("Create destination table", true);

        cCreate.addItemListener(this);

        cDropIndex = new Checkbox("Drop destination index (ignore error)",
                                  true);

        cDropIndex.addItemListener(this);

        cIdxForced = new Checkbox("force Idx_ prefix for indexes names",
                                  false);

        cIdxForced.addItemListener(this);

        cCreateIndex = new Checkbox("Create destination index", true);

        cCreateIndex.addItemListener(this);

        cDelete = new Checkbox("Delete rows in destination table", true);

        cDelete.addItemListener(this);

        cInsert = new Checkbox("Insert into destination", true);

        cInsert.addItemListener(this);

        cFKForced = new Checkbox("force FK_ prefix for foreign key names",
                                 false);

        cFKForced.addItemListener(this);

        cAlter = new Checkbox("Alter destination table", true);

        cAlter.addItemListener(this);
        p.add(createLabel("Source table"));
        p.add(tSourceTable);
        p.add(cTransfer);
        p.add(tDestTable);
        p.add(cDrop);
        p.add(tDestDrop);
        p.add(cCreate);
        p.add(tDestCreate);
        p.add(cDropIndex);
        p.add(tDestDropIndex);
        p.add(cCreateIndex);
        p.add(tDestCreateIndex);
        p.add(cDelete);
        p.add(tDestDelete);
        p.add(cAlter);
        p.add(tDestAlter);
        p.add(createLabel("Select source records"));
        p.add(tSourceSelect);
        p.add(cInsert);
        p.add(tDestInsert);
        p.add(createLabel(""));
        p.add(createLabel(""));
        p.add(cIdxForced);
        p.add(cFKForced);
        p.add(createLabel(""));
        p.add(createLabel(""));

        if (iTransferMode == TRFM_TRANSFER) {
            bStart    = new Button("Start Transfer");
            bContinue = new Button("Continue Transfer");

            bContinue.setEnabled(false);
        } else if (iTransferMode == Transfer.TRFM_DUMP) {
            bStart = new Button("Start Dump");
        } else if (iTransferMode == Transfer.TRFM_RESTORE) {
            bStart = new Button("Start Restore");
        }

        bStart.addActionListener(this);
        p.add(bStart);

        if (iTransferMode == TRFM_TRANSFER) {
            bContinue.addActionListener(this);
            p.add(bContinue);
        }

        bStart.setEnabled(false);
        fMain.add("Center", createBorderPanel(p));

        lTable = new java.awt.List(10);

        lTable.addItemListener(this);
        fMain.add("West", createBorderPanel(lTable));

        tMessage = new TextField();

        Panel pMessage = createBorderPanel(tMessage);

        fMain.add("South", pMessage);
    }
View Full Code Here

     *
     * @param center
     */
    private Panel createBorderPanel(Component center) {

        Panel p = new Panel();

        p.setBackground(SystemColor.control);
        p.setLayout(new BorderLayout());
        p.add("Center", center);
        p.add("South", createLabel(""));
        p.add("East", createLabel(""));
        p.add("West", createLabel(""));
        p.setBackground(SystemColor.control);

        return p;
    }
View Full Code Here

        Dimension d = Toolkit.getDefaultToolkit().getScreenSize();

        setLayout(new BorderLayout());

        Panel p = new Panel(new BorderLayout());
        Panel pLabel;
        Panel pText;
        Panel pButton;
        Panel pClearButton;

        // (ulrivo): full size on screen with less than 640 width
        if (d.width >= 640) {
            pLabel       = new Panel(new GridLayout(8, 1, 10, 10));
            pText        = new Panel(new GridLayout(8, 1, 10, 10));
            pButton      = new Panel(new GridLayout(1, 2, 10, 10));
            pClearButton = new Panel(new GridLayout(8, 1, 10, 10));
        } else {
            pLabel       = new Panel(new GridLayout(8, 1));
            pText        = new Panel(new GridLayout(8, 1));
            pButton      = new Panel(new GridLayout(1, 2));
            pClearButton = new Panel(new GridLayout(8, 1));
        }

        p.add("West", pLabel);
        p.add("Center", pText);
        p.add("South", pButton);
        p.add("North", createLabel(""));
        p.add("East", pClearButton);
        p.setBackground(SystemColor.control);
        pText.setBackground(SystemColor.control);
        pLabel.setBackground(SystemColor.control);
        pButton.setBackground(SystemColor.control);
        pLabel.add(createLabel("Recent:"));

        recent = new Choice();

        try {
            settings = ConnectionDialogCommon.loadRecentConnectionSettings();
        } catch (java.io.IOException ioe) {
            ioe.printStackTrace();
        }

        recent.add(ConnectionDialogCommon.emptySettingName);

        Enumeration en = settings.elements();

        while (en.hasMoreElements()) {
            recent.add(((ConnectionSetting) en.nextElement()).getName());
        }

        recent.addItemListener(new ItemListener() {

            public void itemStateChanged(ItemEvent e) {

                String s = (String) e.getItem();
                ConnectionSetting setting =
                    (ConnectionSetting) settings.get(s);

                if (setting != null) {
                    mName.setText(setting.getName());
                    mDriver.setText(setting.getDriver());
                    mURL.setText(setting.getUrl());
                    mUser.setText(setting.getUser());
                    mPassword.setText(setting.getPassword());
                }
            }
        });
        pText.add(recent);

        Button b;

        b = new Button("Clr");

        b.setActionCommand("Clear");
        b.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {

                ConnectionDialogCommon.deleteRecentConnectionSettings();

                settings = new Hashtable();

                recent.removeAll();
                recent.add(ConnectionDialogCommon.emptySettingName);
                mName.setText(null);
            }
        });
        pClearButton.add(b);
        pLabel.add(createLabel("Setting Name:"));

        mName = new TextField("");

        pText.add(mName);
        pLabel.add(createLabel("Type:"));

        types     = new Choice();
        connTypes = ConnectionDialogCommon.getTypes();

        for (int i = 0; i < connTypes.length; i++) {
            types.add(connTypes[i][0]);
        }

        types.addItemListener(this);
        pText.add(types);
        pLabel.add(createLabel("Driver:"));

        mDriver = new TextField(connTypes[0][1]);

        pText.add(mDriver);
        pLabel.add(createLabel("URL:"));

        mURL = new TextField(connTypes[0][2]);

        mURL.addActionListener(this);
        pText.add(mURL);
        pLabel.add(createLabel("User:"));

        mUser = new TextField("SA");

        mUser.addActionListener(this);
        pText.add(mUser);
        pLabel.add(createLabel("Password:"));

        mPassword = new TextField("");

        mPassword.addActionListener(this);
        mPassword.setEchoChar('*');
        pText.add(mPassword);

        b = new Button("Ok");

        b.setActionCommand("ConnectOk");
        b.addActionListener(this);
        pButton.add(b);

        b = new Button("Cancel");

        b.setActionCommand("ConnectCancel");
        b.addActionListener(this);
        pButton.add(b);
        add("East", createLabel(""));
        add("West", createLabel(""));

        mError = new Label("");

        Panel pMessage = createBorderPanel(mError);

        add("South", pMessage);
        add("North", createLabel(""));
        add("Center", p);
        doLayout();
View Full Code Here

        return l;
    }

    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;
    }
View Full Code Here

        iRecent = (iRecent + 1) % iMaxRecent;
    }

    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);
View Full Code Here

TOP

Related Classes of java.awt.Panel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.