/// <summary> /// Sets up the GUI. /// </summary> private void setupGUI() { addWindowListener(this); JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); int y = 0; JGUIUtil.addComponent(panel, new JLabel("Text:"), 0, y++, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(panel, new JLabel("X:"), 0, y++, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(panel, new JLabel("Y:"), 0, y++, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(panel, new JLabel("Text Position:"), 0, y++, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(panel, new JLabel("Font Name:"), 0, y++, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(panel, new JLabel("Font Size:"), 0, y++, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(panel, new JLabel("Font Style:"), 0, y++, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.EAST); __textTextField = new JTextField(30); __textFieldBackground = __textTextField.getBackground(); __xTextField = new JTextField(15); __yTextField = new JTextField(15); __textPositionComboBox = new SimpleJComboBox(false); string[] positions = GRText.getTextPositions(); __textPositionComboBox.setMaximumRowCount(positions.Length); IList <string> positionsChoices = new List <string>(); for (int i = 0; i < positions.Length; i++) { positionsChoices.Add(positions[i]); } __textPositionComboBox.setData(positionsChoices); __fontNameComboBox = JGUIUtil.newFontNameJComboBox(); __fontSizeTextField = new JTextField(7); __fontStyleComboBox = JGUIUtil.newFontStyleJComboBox(); displayPropListValues(); __textTextField.addKeyListener(this); __xTextField.addKeyListener(this); __yTextField.addKeyListener(this); __fontSizeTextField.addKeyListener(this); __textPositionComboBox.addActionListener(this); __fontNameComboBox.addActionListener(this); __fontStyleComboBox.addActionListener(this); y = 0; JGUIUtil.addComponent(panel, __textTextField, 1, y++, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(panel, __xTextField, 1, y++, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(panel, __yTextField, 1, y++, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(panel, __textPositionComboBox, 1, y++, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(panel, __fontNameComboBox, 1, y++, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(panel, __fontSizeTextField, 1, y++, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(panel, __fontStyleComboBox, 1, y++, 1, 1, 1, 1, GridBagConstraints.NONE, GridBagConstraints.WEST); if (!__editable) { __textTextField.setEditable(false); __xTextField.setEditable(false); __yTextField.setEditable(false); __textPositionComboBox.setEnabled(false); __fontNameComboBox.setEnabled(false); __fontSizeTextField.setEditable(false); __fontStyleComboBox.setEnabled(false); } __applyButton = new JButton(__BUTTON_APPLY); if (__editable) { __applyButton.setToolTipText("Apply changes."); __applyButton.addActionListener(this); } __applyButton.setEnabled(false); JButton cancelButton = new JButton(__BUTTON_CANCEL); cancelButton.setToolTipText("Discard changes and return."); cancelButton.addActionListener(this); __okButton = new JButton(__BUTTON_OK); __okButton.setToolTipText("Accept changes and return."); __okButton.setEnabled(false); __okButton.addActionListener(this); JPanel southPanel = new JPanel(); southPanel.setLayout(new GridBagLayout()); if (__editable) { JGUIUtil.addComponent(southPanel, __applyButton, 0, 0, 1, 1, 1, 1, 0, 10, 0, 10, GridBagConstraints.NONE, GridBagConstraints.EAST); } int space = 0; if (!__editable) { space = 1; } JGUIUtil.addComponent(southPanel, __okButton, 1, 0, 1, 1, space, space, 0, 10, 0, 10, GridBagConstraints.NONE, GridBagConstraints.EAST); if (__editable) { JGUIUtil.addComponent(southPanel, cancelButton, 2, 0, 1, 1, 0, 0, 0, 10, 0, 10, GridBagConstraints.NONE, GridBagConstraints.EAST); } else { __okButton.setEnabled(true); } getContentPane().add("Center", panel); getContentPane().add("South", southPanel); string app = JGUIUtil.getAppNameForWindows(); if (string.ReferenceEquals(app, null) || app.Trim().Equals("")) { app = ""; } else { app += " - "; } setTitle(app + "Node Properties"); pack(); setSize(getWidth() + 100, getHeight()); JGUIUtil.center(this); setVisible(true); }