/** * This function is used to re-run the analyser, and re-create the rows corresponding the its * results. */ private void refreshReviewTable() { reviewPanel.removeAll(); rows.clear(); GridBagLayout gbl = new GridBagLayout(); reviewPanel.setLayout(gbl); GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridy = 0; try { Map<String, Long> sums = analyser.processLogFile(config.getLogFilename(), fromDate.getDate(), toDate.getDate()); for (Entry<String, Long> entry : sums.entrySet()) { String project = entry.getKey(); double hours = 1.0 * entry.getValue() / (1000 * 3600); addRow(gbl, gbc, project, hours); } for (String project : main.getProjectsTree().getTopLevelProjects()) if (!rows.containsKey(project)) addRow(gbl, gbc, project, 0); gbc.insets = new Insets(10, 0, 0, 0); addLeftLabel(gbl, gbc, "TOTAL"); gbc.gridx = 1; gbc.weightx = 1; totalLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 3)); gbl.setConstraints(totalLabel, gbc); reviewPanel.add(totalLabel); gbc.weightx = 0; addRightLabel(gbl, gbc); } catch (IOException e) { e.printStackTrace(); } recomputeTotal(); pack(); }
/** * Sets the mute status icon to the status panel. * * @param isMute indicates if the call with this peer is muted */ public void setMute(final boolean isMute) { if (!SwingUtilities.isEventDispatchThread()) { SwingUtilities.invokeLater( new Runnable() { public void run() { setMute(isMute); } }); return; } if (isMute) { muteStatusLabel.setIcon(new ImageIcon(ImageLoader.getImage(ImageLoader.MUTE_STATUS_ICON))); muteStatusLabel.setBorder(BorderFactory.createEmptyBorder(2, 3, 2, 3)); } else { muteStatusLabel.setIcon(null); muteStatusLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); } // Update input volume control button state to reflect the current // mute status. if (localLevel.isSelected() != isMute) localLevel.setSelected(isMute); this.revalidate(); this.repaint(); }
private JPanel createDynamicCenterPanel(PrimitiveForm primitiveForm, DOTProperty property) { final JTable theTable = new JTable(); PrimitiveFormPropertyPair pfpPair = new PrimitiveFormPropertyPair(primitiveForm.getName(), property); _dynamicTables.put(pfpPair, theTable); DOTPoint dotPoint = (DOTPoint) _dotDefinitionDialogFrame.getScratchDisplayObjectType(); final DynamicDOTItemManager tableModel = (DynamicDOTItemManager) dotPoint.getTableModel(primitiveForm, property); theTable.setModel(tableModel); class NumberComparator implements Comparator<Number> { public int compare(Number o1, Number o2) { final double d1 = o1.doubleValue(); final double d2 = o2.doubleValue(); if (d1 < d2) { return -1; } if (d1 == d2) { return 0; } return 1; } } TableRowSorter<DynamicDOTItemManager> tableRowSorter = new TableRowSorter<DynamicDOTItemManager>(); tableRowSorter.setModel(tableModel); tableRowSorter.setComparator(4, new NumberComparator()); tableRowSorter.setComparator(5, new NumberComparator()); theTable.setRowSorter(tableRowSorter); JButton newDOTItemButton = new JButton("Neue Zeile"); newDOTItemButton.setEnabled(_dotDefinitionDialogFrame.isEditable()); JButton deleteDOTItemButton = new JButton("Zeile löschen"); deleteDOTItemButton.setEnabled(false); JButton showConflictsButton = new JButton("Zeige Konflikte"); addButtonListeners( primitiveForm, property, newDOTItemButton, deleteDOTItemButton, showConflictsButton); addListSelectionListener(theTable, deleteDOTItemButton); JPanel dotButtonsPanel = new JPanel(); dotButtonsPanel.setLayout(new SpringLayout()); dotButtonsPanel.add(newDOTItemButton); dotButtonsPanel.add(deleteDOTItemButton); dotButtonsPanel.add(showConflictsButton); dotButtonsPanel.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10)); SpringUtilities.makeCompactGrid(dotButtonsPanel, 1, 5, 20); JPanel thePanel = new JPanel(); thePanel.setLayout(new SpringLayout()); thePanel.setBorder(BorderFactory.createMatteBorder(2, 2, 2, 2, Color.BLACK)); thePanel.add(new JScrollPane(theTable)); thePanel.add(dotButtonsPanel); SpringUtilities.makeCompactGrid(thePanel, 2, 20, 5); return thePanel; }
protected JPanel makeMessage() { JPanel p = new JPanel(new BorderLayout()); myMessage = new JTextField(30); p.setBorder(BorderFactory.createTitledBorder("message")); p.add(myMessage, BorderLayout.CENTER); return p; }
private JPanel createCentrePanel(YDataStateException exception) { JPanel centrePanel = new JPanel(new GridLayout(1, 2)); JPanel msgPanel = new JPanel(new BorderLayout()); msgPanel.setBackground(YAdminGUI._apiColour); msgPanel.setBorder( BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), "Schema for completing task"), BorderFactory.createEmptyBorder(10, 10, 10, 10))); JTextPane msgTextPane = new JTextPane(); msgTextPane.setContentType("text/plain"); msgTextPane.setFont(new Font("courier", Font.PLAIN, 12)); msgTextPane.setForeground(Color.RED); msgTextPane.setText(exception.getMessage()); msgTextPane.setEditable(false); msgTextPane.setBackground(Color.LIGHT_GRAY); JPanel noWrapPanel = new JPanel(); noWrapPanel.setLayout(new BorderLayout()); noWrapPanel.add(msgTextPane); msgPanel.add(new JScrollPane(noWrapPanel)); centrePanel.add(msgPanel, BorderLayout.NORTH); return centrePanel; }
/** @param frameName title name for frame */ public ShowSavedResults(String frameName) { super(frameName); aboutRes = new JTextArea( "Select a result set from" + "\nthose listed and details" + "\nof that analysis will be" + "\nshown here. Then you can" + "\neither delete or view those" + "\nresults using the buttons below."); aboutScroll = new JScrollPane(aboutRes); ss = new JScrollPane(sp); ss.getViewport().setBackground(Color.white); // resMenu.setLayout(new FlowLayout(FlowLayout.LEFT,10,1)); ClassLoader cl = getClass().getClassLoader(); rfii = new ImageIcon(cl.getResource("images/Refresh_button.gif")); // results status resButtonStatus = new JPanel(new BorderLayout()); Border loweredbevel = BorderFactory.createLoweredBevelBorder(); Border raisedbevel = BorderFactory.createRaisedBevelBorder(); Border compound = BorderFactory.createCompoundBorder(raisedbevel, loweredbevel); statusField = new JTextField(); statusField.setBorder(compound); statusField.setEditable(false); }
public DisplayResults() { GridBagLayout gbl = new GridBagLayout(); GridBagConstraints gbc = new GridBagConstraints(); setLayout(gbl); gbc.anchor = GridBagConstraints.NORTHWEST; gbc.fill = GridBagConstraints.HORIZONTAL; text.setForeground(Color.black); add(text, gbc); gbc.gridy = 0; gbc.gridwidth = GridBagConstraints.REMAINDER; add(emptyLabel, gbc); add(Box.createVerticalStrut(0), gbc); add(emptyLabel, gbc); /* gbc.gridy = 1; VTextMsg result = new VTextMsg(sshare, vnmrif, null); result.setPreferredSize(new Dimension(300, 30)); result.setForeground(Color.black); add( result, gbc ); */ setBorder( new CompoundBorder( BorderFactory.createTitledBorder(" Results "), BorderFactory.createEmptyBorder(10, 10, 10, 10))); }
public DisplayUserDirectory() { GridBagLayout gbl = new GridBagLayout(); GridBagConstraints gbc = new GridBagConstraints(); setLayout(gbl); gbc.anchor = GridBagConstraints.NORTHWEST; gbc.fill = GridBagConstraints.HORIZONTAL; hmlabel.setForeground(Color.black); add(hmlabel, gbc); add(Box.createHorizontalStrut(10), gbc); gbc.gridwidth = GridBagConstraints.REMAINDER; add(hmdir, gbc); add(Box.createVerticalStrut(15), gbc); gbc.gridwidth = 1; vjlabel.setForeground(Color.black); add(vjlabel, gbc); add(Box.createHorizontalStrut(10), gbc); gbc.gridwidth = GridBagConstraints.REMAINDER; add(vjdir, gbc); add(Box.createVerticalStrut(0), gbc); gbc.gridwidth = 1; vjlabel2.setForeground(Color.black); add(vjlabel2, gbc); setBorder( new CompoundBorder( // i18n // BorderFactory.createTitledBorder(" User_Directories "), BorderFactory.createTitledBorder(Util.getAdmLabel("_admin_User_Directories")), BorderFactory.createEmptyBorder(10, 10, 10, 10))); }
public void createColorPanel() { JPanel colorPanel = new JPanel(new GridLayout(0, 1)); int curRow = 0; for (int i = 0; i < colorString.length / 5; i++) { JPanel row = new JPanel(new GridLayout(1, 0, 2, 1)); row.setBorder(new EmptyBorder(2, 2, 2, 2)); for (int j = curRow; j < curRow + 5; j++) { final JLabel colorLabel = new JLabel(null, new ColoredIcon(color[j], 14, 14), JLabel.CENTER); colorLabel.setOpaque(true); final Border emb = BorderFactory.createEmptyBorder(2, 1, 2, 1); final Border lnb = BorderFactory.createLineBorder(Color.black); final Border cmb = BorderFactory.createCompoundBorder(lnb, emb); colorLabel.setBorder(emb); colorLabel.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent e) { JButton btn = (JButton) getTarget(); Color selColor = ((ColoredIcon) colorLabel.getIcon()).getCurrentColor(); btn.setIcon(new ColoredIcon(selColor)); setVisible(false); btn.doClick(); oldLabel.setBackground(null); colorLabel.setBackground(new Color(150, 150, 200)); colorLabel.setBorder(emb); oldLabel = colorLabel; } public void mouseEntered(MouseEvent e) { colorLabel.setBorder(cmb); colorLabel.setBackground(new Color(150, 150, 200)); } public void mouseExited(MouseEvent e) { colorLabel.setBorder(emb); colorLabel.setBackground(null); } }); row.add(colorLabel); } colorPanel.add(row); curRow += row.getComponentCount(); // System.out.println(curRow); } add(colorPanel, BorderLayout.CENTER); // More Colors Button moreColors = new JButton(new ColorChooserAction((JButton) target)); moreColors.setText("More Colors..."); moreColors.setIcon(null); moreColors.setFont(new Font("Verdana", Font.PLAIN, 10)); // JPanel c = new JPanel(new FlowLayout(FlowLayout.CENTER)); c.add(moreColors); add(c, BorderLayout.SOUTH); }
/* *Creates the JTextField for the GUI. */ private JTextField inputField() { inputField = new JTextField(); Border inputBorder = BorderFactory.createEtchedBorder(); inputBorder = BorderFactory.createTitledBorder(inputBorder, "Please type your words here:"); inputField.setBorder(inputBorder); inputField.addActionListener(new ActionListenerField()); return inputField; }
public void setOrientation(int o) { orientation = o; panel.setLayout(new BoxLayout(panel, orientation)); if (isHorisontal()) { panel.setBorder(BorderFactory.createEmptyBorder(9, 0, 0, 0)); } else { panel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); } }
protected void setMainComponent() { mainComponent = new JPanel(new GridBagLayout()); currentPanel = (JPanel) mainComponent; Border mainComponentBorder = BorderFactory.createCompoundBorder( BorderFactory.createEtchedBorder(), BorderFactory.createEmptyBorder(5 + inset, 5 + inset, 5 + inset, 5 + inset)); currentPanel.setBorder(mainComponentBorder); }
public ComboBoxDemo2() { setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS)); String[] patternExamples = { "dd MMMMM yyyy", "dd.MM.yy", "MM/dd/yy", "yyyy.MM.dd G 'at' hh:mm:ss z", "EEE, MMM d, ''yy", "h:mm a", "H:mm:ss:SSS", "K:mm a,z", "yyyy.MMMMM.dd GGG hh:mm aaa" }; currentPattern = patternExamples[0]; // Set up the UI for selecting a pattern. JLabel patternLabel1 = new JLabel("Enter the pattern string or"); JLabel patternLabel2 = new JLabel("select one from the list:"); JComboBox patternList = new JComboBox(patternExamples); patternList.setEditable(true); patternList.addActionListener(this); // Create the UI for displaying result. JLabel resultLabel = new JLabel("Current Date/Time", JLabel.LEADING); // == LEFT result = new JLabel(" "); result.setForeground(Color.black); result.setBorder( BorderFactory.createCompoundBorder( BorderFactory.createLineBorder(Color.black), BorderFactory.createEmptyBorder(5, 5, 5, 5))); // Lay out everything. JPanel patternPanel = new JPanel(); patternPanel.setLayout(new BoxLayout(patternPanel, BoxLayout.PAGE_AXIS)); patternPanel.add(patternLabel1); patternPanel.add(patternLabel2); patternList.setAlignmentX(Component.LEFT_ALIGNMENT); patternPanel.add(patternList); JPanel resultPanel = new JPanel(new GridLayout(0, 1)); resultPanel.add(resultLabel); resultPanel.add(result); patternPanel.setAlignmentX(Component.LEFT_ALIGNMENT); resultPanel.setAlignmentX(Component.LEFT_ALIGNMENT); add(patternPanel); add(Box.createRigidArea(new Dimension(0, 10))); add(resultPanel); setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); reformat(); } // constructor
void updateColor() { if (gNode.isInitial()) { setBackground(Color.yellow); setBorder(BorderFactory.createLineBorder(Color.yellow, 1)); // two pixels wide } else { setBackground(Color.white); setBorder(BorderFactory.createLineBorder(Color.black, 1)); } }
public void updateKeyboardUI() { if (Skin.VIETNAMESE_KEY.isEnabled()) { chkVietnamese.setText(" V "); chkVietnamese.setBackground(Color.yellow); chkVietnamese.setBorder(BorderFactory.createLineBorder(Color.red, 1)); } else { chkVietnamese.setText(" E "); chkVietnamese.setBackground(Color.cyan); chkVietnamese.setBorder(BorderFactory.createLineBorder(Color.blue, 1)); } }
protected void layoutUIComponents(String strPath, boolean bDefaultFile) { JLabel label = null; // i18n // label = new JLabel( "File names can be constructed from a template. The LABEL field is " ); label = new JLabel( Util.getAdmLabel( "_admin_File_names_can_be_constructed_from_a_template._The_LABEL_field_is_")); label.setForeground(Color.black); // m_gbc.weightx = 0.5; showInstruction(m_gbl, m_gbc, 0, 0, 7, label); // i18n // label = new JLabel( "presented as the choice to the user in the \"Data save\" pop-up." ); label = new JLabel( Util.getAdmLabel( "_admin_presented_as_the_choice_to_the_user_in_the_Data_save_pop-up.")); showInstruction(m_gbl, m_gbc, 0, 1, 7, label); showInstruction(m_gbl, m_gbc, 0, 2, 1, new JLabel("")); label = new JLabel(Util.getAdmLabel("_adm_LABEL")); label.setForeground(Color.black); m_gbc.gridx = 1; m_gbc.gridy = 2; m_gbc.ipadx = 10; m_gbl.setConstraints(label, m_gbc); m_pnlDisplay.add(label); label = new JLabel(" "); m_gbc.gridx = 2; m_gbc.gridy = 2; m_gbc.ipadx = 0; // reset to default m_gbc.gridwidth = 5; m_gbl.setConstraints(label, m_gbc); // add( label ); showInstruction(m_gbl, m_gbc, 2, 2, 1, new JLabel(Util.getAdmLabel("_admin_TEMPLATE"))); m_nRow = 3; m_bDefaultFile = bDefaultFile; m_objTxfValue.clearArrays(); displayNewTxf(strPath); m_pnlDisplay.setBorder( new CompoundBorder( BorderFactory.createTitledBorder(Util.getAdmLabel("_admin_User_Directories")), BorderFactory.createEmptyBorder(10, 10, 10, 10))); }
protected void changeBorderDisplay() { if (showBorders) { setBorder(BorderFactory.createTitledBorder("DrawViewPanel")); fromListScrollPane.setBorder(BorderFactory.createTitledBorder("ScrollPane from list")); splitPane.setBorder(BorderFactory.createTitledBorder("Split Pane")); } else { setBorder(null); fromListScrollPane.setBorder(null); splitPane.setBorder(null); } // repaint(); }
/** * Constructs a button panel. * * @param title the title shown in the border * @param options an array of radio button labels */ public ButtonPanel(String title, String... options) { setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), title)); setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); group = new ButtonGroup(); // make one radio button for each option for (String option : options) { JRadioButton b = new JRadioButton(option); b.setActionCommand(option); add(b); group.add(b); b.setSelected(option == options[0]); } }
private JPanel createTopPanel(YWorkItem item) { JPanel topPanel = new JPanel(new BorderLayout()); topPanel.setBackground(YAdminGUI._apiColour); JPanel leftPanel = new JPanel(new BorderLayout()); leftPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); JTextArea explanatoryText = new JTextArea(); explanatoryText.setText( "The data you submitted for this work item was \n" + "validated against a schema (see below). For some reason the\n" + "this data did not succeed in passing the constrainst set\n" + "inside the schema.\n" + "Usage Note: If this is causing problems try using the Web server\n" + "version of YAWL, which supports automatic forms generation.\n" + "Otherwise you could copy the schema from this page and use it\n " + "to create a valid output document using an XML development tool."); explanatoryText.setEditable(false); explanatoryText.setFont(new Font("Arial", Font.BOLD, 12)); explanatoryText.setForeground(Color.DARK_GRAY); explanatoryText.setBackground(YAdminGUI._apiColour); leftPanel.add(explanatoryText); topPanel.add(leftPanel, BorderLayout.WEST); JPanel rightPanel = new JPanel(new GridLayout(4, 2)); rightPanel.setBackground(YAdminGUI._apiColour); rightPanel.setBorder( BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), "Work Item Details"), BorderFactory.createEmptyBorder(10, 10, 10, 10))); YTask task = YEngine.getInstance().getTaskDefinition(item.getSpecificationID(), item.getTaskID()); String taskName = task.getName(); String[] text = { item.getSpecificationID().toString(), taskName, item.getIDString(), item.getStartTimeStr() }; String[] labels = {"Specification ID", "Task Name", "WorkItem ID", "Task Started"}; for (int i = 0; i < text.length; i++) { String s = text[i]; rightPanel.add(new JLabel(labels[i])); JTextField t = new JTextField(s); t.setEditable(false); rightPanel.add(t); } topPanel.add(rightPanel, BorderLayout.CENTER); return topPanel; }
/** * Creates an instance of <tt>CallManager</tt>. * * @param mainFrame The main application window. */ public CallManager(MainFrame mainFrame) { super(new BorderLayout()); this.mainFrame = mainFrame; this.phoneNumberCombo = new CallComboBox(this); this.accountSelectorBox = new AccountSelectorBox(this); this.buttonsPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); this.comboPanel.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 5)); this.init(); }
/*-------------------------------------------------------------------------*/ protected PlayerBodyPartTablePanel(String title, int dirtyFlag) { this.dirtyFlag = dirtyFlag; this.setLayout(new GridLayout(5, 2)); head = new JComboBox(); head.addActionListener(this); torso = new JComboBox(); torso.addActionListener(this); leg = new JComboBox(); leg.addActionListener(this); hand = new JComboBox(); hand.addActionListener(this); foot = new JComboBox(); foot.addActionListener(this); this.add(new JLabel("Head:")); this.add(head); this.add(new JLabel("Torso:")); this.add(torso); this.add(new JLabel("Leg:")); this.add(leg); this.add(new JLabel("Hand:")); this.add(hand); this.add(new JLabel("Foot:")); this.add(foot); this.setBorder(BorderFactory.createTitledBorder(title)); }
/** * Creates the <tt>Component</tt> hierarchy of the area of status-related information such as * <tt>CallPeer</tt> display name, call duration, security status. * * @return the root of the <tt>Component</tt> hierarchy of the area of status-related information * such as <tt>CallPeer</tt> display name, call duration, security status */ private Component createStatusBar() { // stateLabel callStatusLabel.setForeground(Color.WHITE); dtmfLabel.setForeground(Color.WHITE); callStatusLabel.setText(callPeer.getState().getLocalizedStateString()); PeerStatusPanel statusPanel = new PeerStatusPanel(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); constraints.gridx = 0; constraints.gridy = 0; statusPanel.add(securityStatusLabel, constraints); initSecurityStatusLabel(); constraints.gridx++; statusPanel.add(holdStatusLabel, constraints); constraints.gridx++; statusPanel.add(muteStatusLabel, constraints); constraints.gridx++; callStatusLabel.setBorder(BorderFactory.createEmptyBorder(2, 3, 2, 12)); statusPanel.add(callStatusLabel, constraints); constraints.gridx++; constraints.weightx = 1f; statusPanel.add(dtmfLabel, constraints); return statusPanel; }
protected JPanel makeOutput() { JPanel p = new JPanel(new BorderLayout()); myOutput = new JTextArea(10, 40); p.setBorder(BorderFactory.createTitledBorder("output")); p.add(new JScrollPane(myOutput), BorderLayout.CENTER); return p; }
public MainPanel() { super(new BorderLayout()); JPanel p = new JPanel(new GridLayout(2, 1)); final JComboBox<String> c0 = makeComboBox(true, false); final JComboBox<String> c1 = makeComboBox(false, false); final JComboBox<String> c2 = makeComboBox(true, true); final JComboBox<String> c3 = makeComboBox(false, true); p.add(makeTitlePanel("setEditable(false)", Arrays.asList(c0, c1))); p.add(makeTitlePanel("setEditable(true)", Arrays.asList(c2, c3))); p.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); add(p, BorderLayout.NORTH); add( new JButton( new AbstractAction("add") { @Override public void actionPerformed(ActionEvent e) { String str = new Date().toString(); for (JComboBox<String> c : Arrays.asList(c0, c1, c2, c3)) { MutableComboBoxModel<String> m = (MutableComboBoxModel<String>) c.getModel(); m.insertElementAt(str, m.getSize()); } } }), BorderLayout.SOUTH); setPreferredSize(new Dimension(320, 240)); }
private void jbInit() throws Exception { border1 = BorderFactory.createEmptyBorder(20, 20, 20, 20); contentPane.setBorder(border1); contentPane.setLayout(borderLayout1); controlsPane.setLayout(gridLayout1); gridLayout1.setColumns(1); gridLayout1.setHgap(10); gridLayout1.setRows(0); gridLayout1.setVgap(10); okButton.setVerifyInputWhenFocusTarget(true); okButton.setMnemonic('O'); okButton.setText("OK"); buttonsPane.setLayout(flowLayout1); flowLayout1.setAlignment(FlowLayout.CENTER); messagePane.setEditable(false); messagePane.setText(""); borderLayout1.setHgap(10); borderLayout1.setVgap(10); this.setTitle("Subscription Authorization"); this.getContentPane().add(contentPane, BorderLayout.CENTER); contentPane.add(controlsPane, BorderLayout.SOUTH); controlsPane.add(responsesComboBox, null); controlsPane.add(buttonsPane, null); buttonsPane.add(okButton, null); contentPane.add(messageScrollPane, BorderLayout.CENTER); messageScrollPane.getViewport().add(messagePane, null); }
/** * Creates the panel that appears when there are no pages * * @return JPanel */ protected JPanel createFirstPanel() { firstButtonPanel = new JPanel(new GridBagLayout()); firstButtonPanel.setBorder(BorderFactory.createLineBorder(Color.black)); firstButtonPanel.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent _evt) { if (OSPRuntime.isPopupTrigger(_evt)) return; // SwingUtilities.isRightMouseButton(_evt)) return; if (!firstButtonPanel.isEnabled()) return; Object obj = JOptionPane.showInputDialog( getComponent(), res.getString("TabbedEditor.NewName"), res.getString("TabbedEditor.Rename"), JOptionPane.QUESTION_MESSAGE, null, null, getUniqueName(defaultString)); if (obj == null) return; String txt = obj.toString().trim(); if (txt.length() > 0) addPage(defaultType, txt, null, true); else addPage(defaultType, defaultString, null, true); } }); String label = res.getOptionalString("TabbedEditor.ClickHere." + defaultHeader); if (label == null) label = res.getString("TabbedEditor.ClickHere"); firstButton = new JLabel(label); firstButton.setFont(firstButton.getFont().deriveFont(TabbedEditor.BUTTON_FONT_SIZE)); firstButtonPanel.add(firstButton); JPanel firstPanel = new JPanel(new GridLayout(0, 1)); firstPanel.add(firstButtonPanel); return firstPanel; }
/** Sets the correct border depending on the contained object. */ private void setBorder() { /* * !!! When changing border values we should make sure that we * recalculate the X and Y coordinates of the buttons added in * initButtonsPanel and initContactActionButtons functions. If not * correctly calculated problems may occur when clicking buttons! */ if (treeNode instanceof ContactNode && !(((ContactNode) treeNode).getContactDescriptor() instanceof ShowMoreContact)) { this.setBorder( BorderFactory.createEmptyBorder(TOP_BORDER, LEFT_BORDER, BOTTOM_BORDER, RIGHT_BORDER)); } else // GroupNode || ShowMoreContact { this.setBorder(BorderFactory.createEmptyBorder(0, LEFT_BORDER, 0, RIGHT_BORDER)); } }
private Qizi() { isDead = false; this.setBorder(BorderFactory.createRaisedBevelBorder()); this.setBorderPainted(false); this.setOpaque(false); this.setVisible(false); }
private void setupUI() { mainPanel = new JPanel(); mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); mainPanel.add(createCurrentDirectoryPanel()); mainPanel.add(Box.createVerticalStrut(10)); mainPanel.add(createLogLevelPanel()); mainPanel.add(Box.createVerticalStrut(10)); mainPanel.add(createStackTracePanel()); mainPanel.add(Box.createVerticalStrut(10)); mainPanel.add(createOptionsPanel()); mainPanel.add(Box.createVerticalStrut(10)); mainPanel.add(createCustomExecutorPanel()); mainPanel.add(Box.createVerticalStrut(10)); // add a panel that can be used to add custom things to the setup tab customPanelPlaceHolder = new JPanel(new BorderLayout()); mainPanel.add(customPanelPlaceHolder); // Glue alone doesn't work in this situation. This forces everything to the top. JPanel expandingPanel = new JPanel(new BorderLayout()); expandingPanel.add(Box.createVerticalGlue(), BorderLayout.CENTER); mainPanel.add(expandingPanel); mainPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); }
private int addButton(SIPCommButton button, int gridX, int xBounds, boolean isLast) { lastAddedButton = button; constraints.insets = new Insets(0, 0, V_GAP, 0); constraints.anchor = GridBagConstraints.WEST; constraints.fill = GridBagConstraints.NONE; constraints.gridx = gridX; constraints.gridy = 2; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.weightx = 0f; constraints.weighty = 0f; this.add(button, constraints); int yBounds = TOP_BORDER + BOTTOM_BORDER + 2 * V_GAP + ComponentUtils.getStringSize(nameLabel, nameLabel.getText()).height + ComponentUtils.getStringSize(displayDetailsLabel, displayDetailsLabel.getText()) .height; button.setBounds(xBounds, yBounds, BUTTON_WIDTH, BUTTON_HEIGHT); button.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); setButtonBg(button, gridX, isLast); return button.getWidth(); }