Example usage for java.awt GridBagConstraints CENTER

List of usage examples for java.awt GridBagConstraints CENTER

Introduction

In this page you can find the example usage for java.awt GridBagConstraints CENTER.

Prototype

int CENTER

To view the source code for java.awt GridBagConstraints CENTER.

Click Source Link

Document

Put the component in the center of its display area.

Usage

From source file:com.intuit.tank.tools.debugger.FindReplaceDialog.java

/**
 * Constructs a new find dialog according to the specified type of dialog requested. The dialog can be either a FIND
 * dialog, either a REPLACE dialog. In both cases, components displayed remain the sames, but the ones specific to
 * replace feature are grayed out.//from w  w  w.  jav  a  2s.  c om
 * 
 * @param parent
 *            The window holder
 * @param type
 *            The type of the dialog: FindReplace.FIND or FindReplace.REPLACE
 * @param modal
 *            Displays dialog as a modal window if true
 */

public FindReplaceDialog(AgentDebuggerFrame parent, DialogType type) {
    super(parent, type == DialogType.REPLACE ? "Replace" : "Find", true);
    this.parent = parent;

    cbSearch = new JComboBox();
    cbSearch.setEditable(true);
    cbReplace = new JComboBox();
    cbReplace.setEditable(true);
    KeyHandler handler = new KeyHandler();
    tfSearchEditor = (JTextField) cbSearch.getEditor().getEditorComponent();
    tfSearchEditor.addKeyListener(handler);
    tfReplaceEditor = (JTextField) cbReplace.getEditor().getEditorComponent();
    tfReplaceEditor.addKeyListener(handler);

    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints constraints = new GridBagConstraints();
    getContentPane().setLayout(gridbag);
    ((JPanel) getContentPane()).setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
    int gridX = 0;
    int gridY = 0;
    JLabel findLabel = new JLabel("Find");
    buildConstraints(constraints, gridX, gridY, 1, 1, 0, 0);
    constraints.anchor = GridBagConstraints.WEST;
    gridbag.setConstraints(findLabel, constraints);
    getContentPane().add(findLabel);
    gridX++;

    buildConstraints(constraints, gridX, gridY, 1, 1, 100, 0);
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.anchor = GridBagConstraints.CENTER;
    gridbag.setConstraints(cbSearch, constraints);
    getContentPane().add(cbSearch);
    gridX++;

    btnFind = new JButton("Find");
    btnFind.setToolTipText("Find text in scripts");
    btnFind.setMnemonic('F');
    btnFind.addActionListener(this);
    buildConstraints(constraints, gridX, gridY, 1, 1, 0, 0);
    constraints.anchor = GridBagConstraints.CENTER;
    gridbag.setConstraints(btnFind, constraints);
    getContentPane().add(btnFind);
    getRootPane().setDefaultButton(btnFind);
    gridX++;

    btnCancel = new JButton("Cancel");
    btnCancel.setMnemonic('C');
    btnCancel.addActionListener(this);
    buildConstraints(constraints, gridX, gridY, 1, 1, 0, 0);
    constraints.anchor = GridBagConstraints.CENTER;
    gridbag.setConstraints(btnCancel, constraints);
    getContentPane().add(btnCancel);
    gridY++;
    gridX = 0;
    if (type == DialogType.REPLACE) {
        JLabel replaceLabel = new JLabel("Replace");
        buildConstraints(constraints, gridX, gridY, 1, 1, 0, 0);
        constraints.anchor = GridBagConstraints.WEST;
        gridbag.setConstraints(replaceLabel, constraints);
        getContentPane().add(replaceLabel);
        gridX++;

        buildConstraints(constraints, gridX, gridY, 1, 1, 100, 0);
        constraints.fill = GridBagConstraints.HORIZONTAL;
        constraints.anchor = GridBagConstraints.CENTER;
        gridbag.setConstraints(cbReplace, constraints);
        getContentPane().add(cbReplace);
        gridX++;

        btnReplace = new JButton("Replace");
        btnReplace.setToolTipText("REplace in script");
        btnReplace.setMnemonic('R');
        btnReplace.addActionListener(this);
        buildConstraints(constraints, gridX, gridY, 1, 1, 0, 0);
        constraints.anchor = GridBagConstraints.CENTER;
        gridbag.setConstraints(btnReplace, constraints);
        getContentPane().add(btnReplace);
        gridX++;

        btnReplaceAll = new JButton("Replace All");
        btnReplaceAll.addActionListener(this);
        buildConstraints(constraints, gridX, gridY, 1, 1, 0, 0);
        constraints.anchor = GridBagConstraints.CENTER;
        gridbag.setConstraints(btnReplaceAll, constraints);
        getContentPane().add(btnReplaceAll);
        btnReplace.addKeyListener(handler);
        btnReplaceAll.addKeyListener(handler);
        gridY++;
        gridX = 0;
    }

    TitledBorder border = new TitledBorder("Options");
    JPanel panel = new JPanel(new GridLayout(1, 4));
    panel.setBorder(border);
    checkboxWrap = new JCheckBox("Wrap Search");
    panel.add(checkboxWrap);

    checkboxMatchCase = new JCheckBox("Case sensitive");
    panel.add(checkboxMatchCase);

    checkboxRegexp = new JCheckBox("Regular expressions");
    panel.add(checkboxRegexp);

    buildConstraints(constraints, gridX, gridY, 4, 1, 100, 100);
    constraints.anchor = GridBagConstraints.WEST;
    gridbag.setConstraints(panel, constraints);
    getContentPane().add(panel);

    FontMetrics fm = getFontMetrics(getFont());
    cbSearch.setPreferredSize(new Dimension(18 * fm.charWidth('m'), (int) cbSearch.getPreferredSize().height));
    cbReplace
            .setPreferredSize(new Dimension(18 * fm.charWidth('m'), (int) cbReplace.getPreferredSize().height));

    pack();
    // setResizable(false);
    WindowUtil.centerOnParent(this);

    // patch by MJB 8/1/2002
    btnFind.addKeyListener(handler);

    btnCancel.addKeyListener(handler);
    checkboxMatchCase.addKeyListener(handler);
    checkboxRegexp.addKeyListener(handler);

}

From source file:org.bench4Q.console.ui.section.S_LengthSection.java

/**
 * @param resources//w  ww . j a  v  a  2s .  co  m
 * @param processControl
 * @param dispatcherFactory
 * @param TotalOrNot
 * @param agentIdentity
 * @param agentsCollection
 * @throws ConsoleException
 */
public S_LengthSection(Resources resources, ProcessControl processControl,
        SwingDispatcherFactory dispatcherFactory, Boolean TotalOrNot, AgentIdentity agentIdentity,
        AgentsCollection agentsCollection) throws ConsoleException {

    m_resources = resources;
    m_processControl = processControl;
    m_swingDispatcherFactory = dispatcherFactory;

    this.TotalOrNot = TotalOrNot;
    m_agentIdentity = agentIdentity;
    m_agentsCollection = agentsCollection;
    m_agentsCollection.registerObserver(this);

    this.setLayout(new GridBagLayout());
    this.setPreferredSize(new Dimension(683, 475));
    this.setMinimumSize(new Dimension(683, 475));

    picPanel = new PicPanel();
    this.add(picPanel, new GridBagConstraints(0, 0, 1, 5, 99.0, 99.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 1, 1));

}

From source file:org.n52.oxf.ui.swing.ChartDialog.java

/**
 * This method initializes this/*www  .  j a  v  a2  s .  c  o m*/
 * 
 * @return void
 */
private void initialize() {
    this.setSize(dialogWidth, dialogHeight);

    MyGridBagLayout mainLayout = new MyGridBagLayout(this.getContentPane());

    this.getContentPane().setLayout(mainLayout);

    mainLayout.addComponent(0, timePeriodPanel, 0, 1, 1, 1, 10, 10, GridBagConstraints.EAST,
            GridBagConstraints.NONE, new Insets(2, 2, 2, 2));

    mainLayout.addComponent(1, applyButton, 0, 2, 2, 1, 100, 10, GridBagConstraints.CENTER,
            GridBagConstraints.NONE, new Insets(0, 0, 0, 0));

    mainLayout.addComponent(2, nowButton, 1, 1, 1, 1, 10, 10, GridBagConstraints.WEST, GridBagConstraints.NONE,
            new Insets(32, 0, 0, 0));
}

From source file:org.jets3t.gui.ErrorDialog.java

/**
 * Initialises all GUI elements./*from   ww  w . j av  a  2 s . c om*/
 */
private void initGui(String message, String details) {
    // Initialise skins factory.
    skinsFactory = SkinsFactory.getInstance(applicationProperties);

    // Set Skinned Look and Feel.
    LookAndFeel lookAndFeel = skinsFactory.createSkinnedMetalTheme("SkinnedLookAndFeel");
    try {
        UIManager.setLookAndFeel(lookAndFeel);
    } catch (UnsupportedLookAndFeelException e) {
        log.error("Unable to set skinned LookAndFeel", e);
    }

    this.setResizable(false);
    this.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);

    JHtmlLabel messageLabel = skinsFactory.createSkinnedJHtmlLabel("ErrorMessageLabel", hyperlinkListener);
    messageLabel.setText(message);
    messageLabel.setHorizontalAlignment(JLabel.CENTER);
    JHtmlLabel detailsLabel = skinsFactory.createSkinnedJHtmlLabel("ErrorDetailsLabel", hyperlinkListener);
    detailsLabel.setText(details);

    JButton okButton = skinsFactory.createSkinnedJButton("ErrorOkButton");
    okButton.setName("OK");
    okButton.setText("OK");
    okButton.addActionListener(this);
    this.getRootPane().setDefaultButton(okButton);

    JPanel dialogPanel = skinsFactory.createSkinnedJPanel("ErrorDialogPanel");

    int row = 0;
    dialogPanel.setLayout(new GridBagLayout());
    dialogPanel.add(messageLabel, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(12, 5, 12, 5), 0, 0));
    dialogPanel.add(detailsLabel, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsDefault, 0, 0));
    dialogPanel.add(okButton, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.CENTER,
            GridBagConstraints.NONE, insetsDefault, 0, 0));

    this.getContentPane().add(dialogPanel);
    this.pack();
    this.setLocationRelativeTo(this.getOwner());
}

From source file:org.bench4Q.console.ui.section.P_WIRTSection.java

/**
 * @param resources/*from   w  w  w . j a v a  2 s . c  o  m*/
 * @param processControl
 * @param dispatcherFactory
 * @param TotalOrNot
 * @param agentIdentity
 * @param agentsCollection
 * @throws ConsoleException
 */
public P_WIRTSection(Resources resources, ProcessControl processControl,
        SwingDispatcherFactory dispatcherFactory, Boolean TotalOrNot, AgentIdentity agentIdentity,
        AgentsCollection agentsCollection) throws ConsoleException {

    m_resources = resources;
    m_processControl = processControl;
    m_swingDispatcherFactory = dispatcherFactory;

    this.TotalOrNot = TotalOrNot;
    m_agentIdentity = agentIdentity;

    m_agentsCollection = agentsCollection;
    m_agentsCollection.registerObserver(this);

    testduring = -1;
    resultNumber = 0;

    wirt = new ResultSet[15];
    thiswirt = new ArrayList();

    this.setLayout(new GridBagLayout());

    this.setPreferredSize(new Dimension(550, 445));
    this.setMinimumSize(new Dimension(550, 445));

    picPanel = new PicPanel();
    this.add(picPanel, new GridBagConstraints(0, 0, 1, 4, 99.0, 99.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 1, 1));

}

From source file:com.limegroup.gnutella.gui.LicenseWindow.java

protected void createVerifying() {
    GridBagConstraints c = new GridBagConstraints();
    // TODO:  Add a pretty animation.
    JTextArea text = newTextArea(getLocatingString());
    c.anchor = GridBagConstraints.CENTER;
    c.fill = GridBagConstraints.BOTH;
    c.weightx = 1;/*from   w  w  w  . j av  a2  s.  c o m*/
    c.weighty = 1;
    DETAILS.add(text, c);
}

From source file:org.bench4Q.console.ui.section.S_SummarizeSection.java

/**
 * @param resources/*from   w  w  w.  jav a  2 s  .  c  om*/
 * @param processControl
 * @param dispatcherFactory
 * @param TotalOrNot
 * @param agentIdentity
 * @param agentsCollection
 * @throws ConsoleException
 */
public S_SummarizeSection(Resources resources, ProcessControl processControl,
        SwingDispatcherFactory dispatcherFactory, Boolean TotalOrNot, AgentIdentity agentIdentity,
        AgentsCollection agentsCollection) throws ConsoleException {

    m_resources = resources;
    m_processControl = processControl;
    m_swingDispatcherFactory = dispatcherFactory;

    this.TotalOrNot = TotalOrNot;
    m_agentIdentity = agentIdentity;
    m_agentsCollection = agentsCollection;
    m_agentsCollection.registerObserver(this);

    ErrorSession = new int[15];

    this.setLayout(new GridBagLayout());
    this.setPreferredSize(new Dimension(683, 475));
    this.setMinimumSize(new Dimension(683, 475));

    picPanel = new PicPanel();
    this.add(picPanel, new GridBagConstraints(0, 0, 1, 5, 99.0, 99.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 1, 1));

}

From source file:com.sec.ose.osi.ui.dialog.setting.JPanReportProperty.java

/**
 * This method initializes this//from  w  w w.j av  a  2s  .  c om
 * 
 * @return void
 */
private void initialize() {
    GridBagConstraints gridBagConstraints9 = new GridBagConstraints();
    gridBagConstraints9.gridx = 2;
    gridBagConstraints9.fill = GridBagConstraints.HORIZONTAL;
    gridBagConstraints9.gridwidth = 2;
    gridBagConstraints9.insets = new Insets(10, 10, 0, 10);
    gridBagConstraints9.anchor = GridBagConstraints.NORTH;
    gridBagConstraints9.gridy = 0;
    GridBagConstraints gridBagConstraints7 = new GridBagConstraints();
    gridBagConstraints7.gridx = 0;
    gridBagConstraints7.fill = GridBagConstraints.BOTH;
    gridBagConstraints7.gridwidth = 2;
    gridBagConstraints7.insets = new Insets(0, 0, 0, 0);
    gridBagConstraints7.weightx = 1.0;
    gridBagConstraints7.weighty = 1.0;
    gridBagConstraints7.anchor = GridBagConstraints.CENTER;
    gridBagConstraints7.gridy = 0;
    this.setLayout(new GridBagLayout());
    this.add(getJPanelValue(), gridBagConstraints7);
    this.add(getJPanelButtons(), gridBagConstraints9);
}

From source file:rhinova.gui.dataentry.link.LinkDataEntryPanel.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner non-commercial license
    vSpacer5 = new JPanel(null);
    label2 = new JLabel();
    hSpacer1 = new JPanel(null);
    label1 = new JLabel();
    txtName = new JTextField();
    vSpacer4 = new JPanel(null);
    label6 = new JLabel();
    txtCap = new JTextField();
    vSpacer3 = new JPanel(null);
    label7 = new JLabel();
    txtSur = new JTextField();
    hSpacer2 = new JPanel(null);
    vSpacer2 = new JPanel(null);
    label8 = new JLabel();
    res1 = new JComboBox();
    vSpacer1 = new JPanel(null);
    label9 = new JLabel();
    res2 = new JComboBox();
    vSpacer6 = new JPanel(null);
    btnCreate = new JButton();
    hSpacer3 = new JPanel(null);

    //======== this ========
    setLayout(new GridBagLayout());
    ((GridBagLayout) getLayout()).columnWidths = new int[] { 0, 65, 145, 0, 0 };
    ((GridBagLayout) getLayout()).rowHeights = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    ((GridBagLayout) getLayout()).columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 1.0E-4 };
    ((GridBagLayout) getLayout()).rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
            0.0, 0.0, 0.0, 0.0, 1.0E-4 };
    add(vSpacer5, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));

    //---- label2 ----
    label2.setText("Link Entry Panel");
    label2.setFont(new Font("Tahoma", Font.PLAIN, 16));
    add(label2, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
            new Insets(0, 0, 5, 5), 0, 0));
    add(hSpacer1, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));

    //---- label1 ----
    label1.setText("name");
    add(label1, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
            new Insets(0, 0, 5, 5), 0, 0));
    add(txtName, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));
    add(vSpacer4, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));

    //---- label6 ----
    label6.setText("capacity");
    add(label6, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
            new Insets(0, 0, 5, 5), 0, 0));
    add(txtCap, new GridBagConstraints(2, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
            new Insets(0, 0, 5, 5), 0, 0));
    add(vSpacer3, new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));

    //---- label7 ----
    label7.setText("survival rate");
    add(label7, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
            new Insets(0, 0, 5, 5), 0, 0));
    add(txtSur, new GridBagConstraints(2, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
            new Insets(0, 0, 5, 5), 0, 0));
    add(hSpacer2, new GridBagConstraints(3, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0));
    add(vSpacer2, new GridBagConstraints(1, 7, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));

    //---- label8 ----
    label8.setText("reserve1");
    add(label8, new GridBagConstraints(1, 8, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
            new Insets(0, 0, 5, 5), 0, 0));
    add(res1, new GridBagConstraints(2, 8, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
            new Insets(0, 0, 5, 5), 0, 0));
    add(vSpacer1, new GridBagConstraints(1, 9, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));

    //---- label9 ----
    label9.setText("reserve2");
    add(label9, new GridBagConstraints(1, 10, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));
    add(res2, new GridBagConstraints(2, 10, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
            new Insets(0, 0, 5, 5), 0, 0));
    add(vSpacer6, new GridBagConstraints(1, 11, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));

    //---- btnCreate ----
    btnCreate.setText("Create Link");
    btnCreate.addActionListener(new ActionListener() {
        @Override/*from w w  w . ja v  a 2  s .co m*/
        public void actionPerformed(ActionEvent e) {
            btnCreateActionPerformed(e);
        }
    });
    add(btnCreate, new GridBagConstraints(2, 12, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));
    add(hSpacer3, new GridBagConstraints(2, 13, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0));
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}

From source file:net.mumie.coursecreator.gui.ClassChooser.java

private void buildLayout() {
    //       Dimensions of the Dialog      
    int width = 10;
    int height = 160;
    int buttonWidth = 100;
    int buttonHeight = 30;

    // sets the Layout
    this.getContentPane().setLayout(new GridBagLayout());

    // the Button and Label Text
    String okButtonText = "Zuweisen";
    String cancelButtonText = "Cancel";
    headlineLabelText = "";

    // the Fonts//from   w w w .  jav a  2  s  .  c  o m
    Font font = new Font("SansSerif", Font.PLAIN, 14);
    Font headlineLabelFont = new Font("SansSerif", Font.PLAIN, 12);
    Font textFieldFont = new Font("Monospaced", Font.PLAIN, 10);

    // GridBagContraints for rootPanel (s.b.):
    GridBagConstraints rootPanelStyle = createGridBagContrains(GridBagConstraints.CENTER, 4, 4, 4, 4, 0, 0);

    // GridBagContraints for headlineLabel:
    GridBagConstraints headlineLabelStyle = createGridBagContrains(GridBagConstraints.CENTER, 6, 6, 6, 6, 0, 0);

    // GridBagConstraints for textFieldPanel (s.b.):
    GridBagConstraints textFieldPanelStyle = createGridBagContrains(GridBagConstraints.CENTER, 4, 4, 4, 4, 0,
            1);

    // GridBagConstraints for buttonPanel (s.b.):
    GridBagConstraints buttonPanelStyle = createGridBagContrains(GridBagConstraints.CENTER, 4, 4, 4, 4, 0, 2);

    // GridBagConstraints for serverTextField:
    GridBagConstraints serverTextFieldStyle = createGridBagContrains(GridBagConstraints.WEST, 6, 6, 6, 6, 1, 0);

    // GridBagContraints for okButton (s.b.):
    GridBagConstraints okButtonStyle = createGridBagContrains(GridBagConstraints.CENTER, 6, 6, 6, 6, 0, 0);

    // GridBagContraints for cancelButton (s.b.):
    GridBagConstraints cancelButtonStyle = createGridBagContrains(GridBagConstraints.CENTER, 6, 6, 6, 6, 1, 0);

    // Creating rootPanel (contains all components)
    JPanel rootPanel = new JPanel(new GridBagLayout());
    rootPanel.setFont(font);

    // Creating headlineLabel:
    JLabel headlineLabel = new JLabel(headlineLabelText);
    headlineLabel.setFont(headlineLabelFont);

    // Creating textFieldPanel:
    JPanel textFieldPanel = new JPanel(new GridBagLayout());
    textFieldPanel.setFont(font);

    // Creating classTextField:
    classBox = new JComboBox(this.classList);
    classBox.setFont(textFieldFont);

    String classPath = this.controller.getMetaInfoField().getMetaInfos().getClassPath();
    String className = this.controller.getMetaInfoField().getMetaInfos().getClassName();

    if (setSelectedClass(classPath, className) == -1)
        headlineLabel.setForeground(Color.RED);
    else
        headlineLabel.setForeground(Color.BLACK);

    headlineLabel.setText(this.headlineLabelText);

    // Creating buttonPanel:
    JPanel buttonPanel = new JPanel(new GridBagLayout());
    buttonPanel.setFont(font);

    // okButton:
    JButton okButton = new JButton(okButtonText);
    okButton.setPreferredSize(new Dimension(buttonWidth, buttonHeight));
    okButton.setActionCommand(CommandConstants.META_INFO_FIELD_OK);
    okButton.addActionListener(this.controller);

    // cancelButton:
    JButton cancelButton = new JButton(cancelButtonText);
    cancelButton.setPreferredSize(new Dimension(buttonWidth, buttonHeight));
    cancelButton.setActionCommand(CommandConstants.META_INFO_FIELD_CANCEL);
    cancelButton.addActionListener(this.controller);

    // Composing the GUI:
    this.getContentPane().setLayout(new GridBagLayout());
    this.getContentPane().add(rootPanel, rootPanelStyle);
    rootPanel.add(headlineLabel, headlineLabelStyle);
    rootPanel.add(textFieldPanel, textFieldPanelStyle);
    textFieldPanel.add(classBox, serverTextFieldStyle);
    rootPanel.add(buttonPanel, buttonPanelStyle);
    buttonPanel.add(okButton, okButtonStyle);
    buttonPanel.add(cancelButton, cancelButtonStyle);

    this.addWindowListener(this.windowListener);

    int maxString = this.headlineLabelText.length();
    for (int i = 0; i < this.classList.size(); i++) {
        maxString = Math.max(((String) this.classList.get(i).toString()).length(), maxString);
    }

    width = Math.max(width, maxString * 8);
    this.setSize(width, height);
}