Search in sources :

Example 26 with Insets

use of java.awt.Insets in project pcgen by PCGen.

the class CoreViewFrame method initialize.

public void initialize(CharacterFacade character) {
    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    getContentPane().setLayout(gridbag);
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.NORTHWEST;
    c.insets = new Insets(2, 2, 2, 2);
    int col = 0;
    Utility.buildConstraints(c, col, 0, 1, 1, 100, 20);
    JLabel label = new JLabel(LanguageBundle.getFormattedString(//$NON-NLS-1$
    "in_CoreView_Perspective"));
    gridbag.setConstraints(label, c);
    getContentPane().add(label);
    Utility.buildConstraints(c, col++, 1, 1, 1, 0, 20);
    gridbag.setConstraints(perspectiveChooser, c);
    getContentPane().add(perspectiveChooser);
    Utility.buildConstraints(c, 0, 2, col, 1, 0, 1000);
    viewTable.setAutoCreateRowSorter(true);
    JScrollPane pane = new JScrollPane(viewTable);
    pane.setPreferredSize(new Dimension(500, 300));
    gridbag.setConstraints(pane, c);
    getContentPane().add(pane);
    setTitle("Core Debug View");
    getContentPane().setSize(500, 400);
    pack();
    Utility.centerComponent(this, true);
}
Also used : JScrollPane(javax.swing.JScrollPane) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension)

Example 27 with Insets

use of java.awt.Insets in project pcgen by PCGen.

the class OptionsPathDialog method initComponents.

private void initComponents() {
    setResizable(false);
    setTitle("Directory for options.ini location");
    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    getContentPane().setLayout(new GridBagLayout());
    GridBagConstraints gridBagConstraints = new GridBagConstraints();
    JLabel label = new JLabel("Select a directory to store PCGen options in:");
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.insets = new Insets(4, 4, 0, 4);
    getContentPane().add(label, gridBagConstraints);
    gridBagConstraints.insets = new Insets(2, 0, 2, 0);
    getContentPane().add(new JSeparator(), gridBagConstraints);
    label = new JLabel("If you have an existing options.ini file," + "then select the directory containing that file");
    gridBagConstraints.insets = new Insets(4, 4, 4, 4);
    getContentPane().add(label, gridBagConstraints);
    ActionListener handler = new ActionHandler();
    ButtonGroup group = new ButtonGroup();
    gridBagConstraints.insets = new Insets(0, 4, 0, 4);
    addRadioButton("<html><b>PCGen Dir</b>: This is the directory that PCGen is installed into", SettingsFilesPath.pcgen.name(), group, handler, gridBagConstraints);
    // Remark: do mac user really need to be able to put the file either in a specific mac dir or home?
    if (SystemUtils.IS_OS_MAC_OSX) {
        addRadioButton("<html><b>Mac User Dir</b>", SettingsFilesPath.mac_user.name(), group, handler, gridBagConstraints);
    } else if (SystemUtils.IS_OS_UNIX) {
        // putting it the same way as mac. merging all and using a system config dir instead would be better IMHO.
        addRadioButton("<html><b>Freedesktop configuration sub-directory</b> Use for most Linux/BSD", SettingsFilesPath.FD_USER.name(), group, handler, gridBagConstraints);
    }
    addRadioButton("<html><b>Home Dir</b>: This is your home directory", SettingsFilesPath.user.name(), group, handler, gridBagConstraints);
    addRadioButton("Select a directory to use", "select", group, handler, gridBagConstraints);
    dirField.setText(ConfigurationSettings.getSettingsDirFromFilePath(selectedDir));
    dirField.setEditable(false);
    gridBagConstraints.gridwidth = GridBagConstraints.RELATIVE;
    gridBagConstraints.weightx = 1;
    gridBagConstraints.insets = new Insets(0, 4, 0, 0);
    getContentPane().add(dirField, gridBagConstraints);
    dirButton.setText("...");
    dirButton.setEnabled(false);
    dirButton.addActionListener(handler);
    dirButton.setActionCommand("custom");
    dirButton.setMargin(new Insets(2, 2, 2, 2));
    GridBagConstraints bagConstraints = new GridBagConstraints();
    bagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    bagConstraints.insets = new Insets(0, 0, 0, 4);
    getContentPane().add(dirButton, bagConstraints);
    JButton okButton = new JButton("OK");
    okButton.setPreferredSize(new Dimension(75, 23));
    okButton.setActionCommand("ok");
    okButton.addActionListener(handler);
    bagConstraints.insets = new Insets(4, 0, 4, 0);
    getContentPane().add(okButton, bagConstraints);
    getRootPane().setDefaultButton(okButton);
    pack();
    setLocationRelativeTo(null);
}
Also used : GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) ActionListener(java.awt.event.ActionListener) ButtonGroup(javax.swing.ButtonGroup) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) JSeparator(javax.swing.JSeparator)

Example 28 with Insets

use of java.awt.Insets 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 29 with Insets

use of java.awt.Insets in project voltdb by VoltDB.

the class ZaurusDatabaseManager method main.

/**
     * Method declaration
     *
     *
     * @param arg
     */
public static void main(String[] arg) {
    bMustExit = true;
    // (ulrivo): read all arguments from the command line
    int i = 0;
    while (i < arg.length) {
        if (arg[i].equalsIgnoreCase("-driver") && (i + 1 < arg.length)) {
            i++;
            defDriver = arg[i];
        } else if (arg[i].equalsIgnoreCase("-url") && (i + 1 < arg.length)) {
            i++;
            defURL = arg[i];
        } else if (arg[i].equalsIgnoreCase("-width") && (i + 1 < arg.length)) {
            i++;
            try {
                defWidth = Integer.parseInt(arg[i]);
            } catch (Exception e) {
            }
        } else if (arg[i].equalsIgnoreCase("-height") && (i + 1 < arg.length)) {
            i++;
            try {
                defHeight = Integer.parseInt(arg[i]);
            } catch (Exception e) {
            }
        } else if (arg[i].equalsIgnoreCase("-locx") && (i + 1 < arg.length)) {
            i++;
            try {
                defLocX = Integer.parseInt(arg[i]);
            } catch (Exception e) {
            }
        } else if (arg[i].equalsIgnoreCase("-locy") && (i + 1 < arg.length)) {
            i++;
            try {
                defLocY = Integer.parseInt(arg[i]);
            } catch (Exception e) {
            }
        } else if (arg[i].equalsIgnoreCase("-user") && (i + 1 < arg.length)) {
            i++;
            defUser = arg[i];
        } else if (arg[i].equalsIgnoreCase("-password") && (i + 1 < arg.length)) {
            i++;
            defPassword = arg[i];
        } else if (arg[i].equalsIgnoreCase("-query") && (i + 1 < arg.length)) {
            i++;
            defQuery = arg[i];
        } else if (arg[i].equalsIgnoreCase("-defDirectory") && (i + 1 < arg.length)) {
            i++;
            defDirectory = arg[i];
        } else if (arg[i].equalsIgnoreCase("-database") && (i + 1 < arg.length)) {
            i++;
            defDatabase = arg[i];
        } else {
            showUsage();
            return;
        }
        i++;
    }
    ZaurusDatabaseManager m = new ZaurusDatabaseManager();
    m.main();
    // (ulrivo): make default connection if arguments set via the command line
    Connection c = null;
    if ((defDriver != null && defURL != null) || (defDatabase != null)) {
        if (defDatabase != null) {
            defDriver = "org.hsqldb_voltpatches.jdbcDriver";
            defURL = "jdbc:hsqldb:" + defDatabase;
            defUser = "SA";
            defPassword = "";
        }
        try {
            Class.forName(defDriver).newInstance();
            c = DriverManager.getConnection(defURL, defUser, defPassword);
        } catch (Exception e) {
            System.out.println("No connection for " + defDriver + " at " + defURL);
            e.printStackTrace();
        }
    } else {
        c = ZaurusConnectionDialog.createConnection(m.fMain, "Connect", new Insets(defWidth, defHeight, defLocX, defLocY));
    }
    if (c == null) {
        return;
    }
    m.connect(c);
}
Also used : Insets(java.awt.Insets) Connection(java.sql.Connection) SQLException(java.sql.SQLException) IOException(java.io.IOException)

Example 30 with Insets

use of java.awt.Insets in project pcgen by PCGen.

the class CastSpell method addDescriptionPanel.

private void addDescriptionPanel() {
    GridBagConstraints gridBagConstraints = null;
    descPanel = new JPanel(new BorderLayout());
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = gridBagRow;
    gridBagConstraints.gridwidth = 3;
    gridBagConstraints.gridheight = 1;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.insets = new Insets(3, 3, 3, 3);
    mainPanel.add(descPanel, gridBagConstraints);
    gridBagRow++;
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) BorderLayout(java.awt.BorderLayout) GridBagConstraints(java.awt.GridBagConstraints)

Aggregations

Insets (java.awt.Insets)1623 GridBagConstraints (java.awt.GridBagConstraints)1049 GridBagLayout (java.awt.GridBagLayout)828 JPanel (javax.swing.JPanel)728 JLabel (javax.swing.JLabel)652 Dimension (java.awt.Dimension)411 JButton (javax.swing.JButton)366 ActionEvent (java.awt.event.ActionEvent)296 ActionListener (java.awt.event.ActionListener)277 JScrollPane (javax.swing.JScrollPane)226 BorderLayout (java.awt.BorderLayout)221 JTextField (javax.swing.JTextField)205 JCheckBox (javax.swing.JCheckBox)142 Component (java.awt.Component)113 Color (java.awt.Color)103 Font (java.awt.Font)100 Point (java.awt.Point)100 ImageIcon (javax.swing.ImageIcon)100 EmptyBorder (javax.swing.border.EmptyBorder)92 FlowLayout (java.awt.FlowLayout)91