List of usage examples for javax.swing BorderFactory createEmptyBorder
public static Border createEmptyBorder(int top, int left, int bottom, int right)
From source file:com.raceup.fsae.test.TesterGui.java
/** * Shows gui to start a test//w ww. j a va 2s . co m */ private void openQuestionsPanel() { currentSubmissionTimer = new ClockTimer("Current submission time"); // start timer currentSubmissionTimer.start(); totalTestTimer.start(); shuffleQuestions(); testPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10) // title border ); JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS)); panel.add(Box.createVerticalStrut(20)); panel.add(new JScrollPane(testPanel)); panel.add(createTimersPanel()); panel.add(createMonitorPanel()); setContentPane(panel); // scroll pane with questions setPreferredSize(new Dimension(400, 600)); pack(); repaint(); setLocationRelativeTo(null); }
From source file:net.sf.profiler4j.console.ClassListPanel.java
/** * This method initializes classesTable/* w w w . j a va 2 s. c om*/ * * @return javax.swing.JTable */ private JTable getClassesTable() { if (classesTable == null) { classesTable = new JTable(); classesTable.setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); classesTable.setFont(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 12)); classesTable.setModel(getClassListTableModel()); classesTable.setRowHeight(20); classesTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (classesTable.getSelectedRowCount() > 0) { addAsRuleButton.setEnabled(true); } else { addAsRuleButton.setEnabled(false); } } }); TableColumn c = classesTable.getColumnModel().getColumn(0); c.setMinWidth(50); c.setMaxWidth(50); c = classesTable.getColumnModel().getColumn(1); c.setMinWidth(300); c.setCellRenderer(new DefaultTableCellRenderer() { Font f1 = new Font("Tahoma", java.awt.Font.PLAIN, 12); Font f2 = new Font("Tahoma", java.awt.Font.BOLD, 12); @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); if (isSelected) { setFont(f2); } else { setFont(f1); } if (classListTableModel.getRow(row).info.isInstrumented()) { if (isSelected) { setForeground(Color.YELLOW); setBackground(Color.BLUE); } else { setBackground(Color.decode("#bbffbb")); setForeground(Color.BLACK); } } else { if (isSelected) { setForeground(Color.WHITE); setBackground(Color.BLUE); } else { setBackground(Color.WHITE); setForeground(Color.BLACK); } } setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 4)); return this; } }); } return classesTable; }
From source file:net.sf.jabref.gui.FileListEntryEditor.java
public FileListEntryEditor(JabRefFrame frame, FileListEntry entry, boolean showProgressBar, boolean showOpenButton, BibDatabaseContext databaseContext) { this.entry = entry; this.databaseContext = databaseContext; ActionListener okAction = e -> { // If OK button is disabled, ignore this event: if (!ok.isEnabled()) { return; }//from w w w. ja v a2 s .c om // If necessary, ask the external confirm object whether we are ready to close. if (externalConfirm != null) { // Construct an updated FileListEntry: storeSettings(entry); if (!externalConfirm.confirmClose(entry)) { return; } } diag.dispose(); storeSettings(FileListEntryEditor.this.entry); okPressed = true; }; types = new JComboBox<>(); types.addItemListener(itemEvent -> { if (!okDisabledExternally) { ok.setEnabled(types.getSelectedItem() != null); } }); FormBuilder builder = FormBuilder.create().layout(new FormLayout( "left:pref, 4dlu, fill:150dlu, 4dlu, fill:pref, 4dlu, fill:pref", "p, 2dlu, p, 2dlu, p")); builder.add(Localization.lang("Link")).xy(1, 1); builder.add(link).xy(3, 1); final BrowseListener browse = new BrowseListener(frame, link); final JButton browseBut = new JButton(Localization.lang("Browse")); browseBut.addActionListener(browse); builder.add(browseBut).xy(5, 1); JButton open = new JButton(Localization.lang("Open")); if (showOpenButton) { builder.add(open).xy(7, 1); } builder.add(Localization.lang("Description")).xy(1, 3); builder.add(description).xyw(3, 3, 3); builder.getPanel().setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); builder.add(Localization.lang("File type")).xy(1, 5); builder.add(types).xyw(3, 5, 3); if (showProgressBar) { builder.appendRows("2dlu, p"); builder.add(downloadLabel).xy(1, 7); builder.add(prog).xyw(3, 7, 3); } ButtonBarBuilder bb = new ButtonBarBuilder(); bb.addGlue(); bb.addRelatedGap(); bb.addButton(ok); JButton cancel = new JButton(Localization.lang("Cancel")); bb.addButton(cancel); bb.addGlue(); bb.getPanel().setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); ok.addActionListener(okAction); // Add OK action to the two text fields to simplify entering: link.addActionListener(okAction); description.addActionListener(okAction); open.addActionListener(e -> openFile()); AbstractAction cancelAction = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { diag.dispose(); } }; cancel.addActionListener(cancelAction); // Key bindings: ActionMap am = builder.getPanel().getActionMap(); InputMap im = builder.getPanel().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close"); am.put("close", cancelAction); link.getDocument().addDocumentListener(new DocumentListener() { @Override public void insertUpdate(DocumentEvent documentEvent) { checkExtension(); } @Override public void removeUpdate(DocumentEvent documentEvent) { // Do nothing } @Override public void changedUpdate(DocumentEvent documentEvent) { checkExtension(); } }); diag = new JDialog(frame, Localization.lang("Save file"), true); diag.getContentPane().add(builder.getPanel(), BorderLayout.CENTER); diag.getContentPane().add(bb.getPanel(), BorderLayout.SOUTH); diag.pack(); diag.setLocationRelativeTo(frame); diag.addWindowListener(new WindowAdapter() { @Override public void windowActivated(WindowEvent event) { if (openBrowseWhenShown && !dontOpenBrowseUntilDisposed) { dontOpenBrowseUntilDisposed = true; SwingUtilities.invokeLater(() -> browse.actionPerformed(new ActionEvent(browseBut, 0, ""))); } } @Override public void windowClosed(WindowEvent event) { dontOpenBrowseUntilDisposed = false; } }); setValues(entry); }
From source file:de.atomfrede.tools.evalutation.ui.ExceptionDialog.java
@SuppressWarnings("serial") @Override/*from w ww. j av a2 s. c o m*/ public ButtonPanel createButtonPanel() { ButtonPanel buttonPanel = new ButtonPanel(); JButton closeButton = new JButton(); JButton detailButton = new JButton(); detailButton.setMnemonic('D'); closeButton.setName(OK); buttonPanel.addButton(closeButton, ButtonPanel.AFFIRMATIVE_BUTTON); buttonPanel.addButton(detailButton, ButtonPanel.OTHER_BUTTON); closeButton.setAction(new AbstractAction("Close") { @Override public void actionPerformed(ActionEvent e) { setDialogResult(RESULT_AFFIRMED); setVisible(false); dispose(); } }); detailButton.setAction(new AbstractAction("Details >>") { @Override public void actionPerformed(ActionEvent e) { if (_detailsPanel.isVisible()) { _detailsPanel.setVisible(false); putValue(Action.NAME, "Details <<"); pack(); } else { _detailsPanel.setVisible(true); putValue(Action.NAME, "<< Details"); pack(); } } }); setDefaultCancelAction(closeButton.getAction()); setDefaultAction(closeButton.getAction()); getRootPane().setDefaultButton(closeButton); buttonPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); buttonPanel.setSizeConstraint(ButtonPanel.NO_LESS_THAN); return buttonPanel; }
From source file:com.sshtools.common.ui.SshToolsConnectionHostTab.java
/** * Creates a new SshToolsConnectionHostTab object. */// w w w . ja v a2 s . c o m public SshToolsConnectionHostTab() { super(); // Create the main connection details panel JPanel mainConnectionDetailsPanel = new JPanel(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.anchor = GridBagConstraints.NORTHWEST; gbc.insets = new Insets(0, 2, 2, 2); gbc.weightx = 1.0; // Host name UIUtil.jGridBagAdd(mainConnectionDetailsPanel, new JLabel("Hostname"), gbc, GridBagConstraints.REMAINDER); gbc.fill = GridBagConstraints.HORIZONTAL; UIUtil.jGridBagAdd(mainConnectionDetailsPanel, jTextHostname, gbc, GridBagConstraints.REMAINDER); gbc.fill = GridBagConstraints.NONE; // Port UIUtil.jGridBagAdd(mainConnectionDetailsPanel, new JLabel("Port"), gbc, GridBagConstraints.REMAINDER); UIUtil.jGridBagAdd(mainConnectionDetailsPanel, jTextPort, gbc, GridBagConstraints.REMAINDER); // Username UIUtil.jGridBagAdd(mainConnectionDetailsPanel, new JLabel("Username"), gbc, GridBagConstraints.REMAINDER); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.weighty = 1.0; UIUtil.jGridBagAdd(mainConnectionDetailsPanel, jTextUsername, gbc, GridBagConstraints.REMAINDER); gbc.fill = GridBagConstraints.NONE; // IconWrapperPanel iconMainConnectionDetailsPanel = new IconWrapperPanel( new ResourceIcon(SshToolsConnectionHostTab.class, CONNECT_ICON), mainConnectionDetailsPanel); // Authentication methods panel JPanel authMethodsPanel = new JPanel(new GridBagLayout()); authMethodsPanel.setBorder(BorderFactory.createEmptyBorder(4, 0, 0, 0)); gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.anchor = GridBagConstraints.NORTHWEST; gbc.insets = new Insets(2, 2, 2, 2); gbc.weightx = 1.0; gbc.weighty = 0.0; gbc.gridx = 0; gbc.gridy = 0; gbc.gridwidth = 2; GridBagConstraints gbc2 = new GridBagConstraints(); gbc2.fill = GridBagConstraints.HORIZONTAL; gbc2.anchor = GridBagConstraints.NORTHWEST; gbc2.insets = new Insets(2, 2, 2, 2); gbc2.weightx = 1.0; gbc2.weighty = 0.0; gbc2.gridx = 0; gbc2.gridy = 1; gbc2.gridwidth = 2; GridBagConstraints gbc3 = new GridBagConstraints(); gbc3.fill = GridBagConstraints.HORIZONTAL; gbc3.anchor = GridBagConstraints.NORTHWEST; gbc3.insets = new Insets(2, 2, 2, 2); gbc3.weightx = 1.0; gbc3.weighty = 0.0; gbc3.gridx = 0; gbc3.gridy = 2; gbc3.gridwidth = 2; GridBagConstraints gbc4 = new GridBagConstraints(); gbc4.fill = GridBagConstraints.HORIZONTAL; gbc4.anchor = GridBagConstraints.NORTHWEST; gbc4.insets = new Insets(26, 2, 2, 2); gbc4.weightx = 0.0; gbc4.weighty = 0.0; gbc4.gridx = 0; gbc4.gridy = 3; gbc4.gridwidth = 1; GridBagConstraints gbc5 = new GridBagConstraints(); gbc5.fill = GridBagConstraints.NONE; gbc5.anchor = GridBagConstraints.WEST; gbc5.insets = new Insets(26, 2, 2, 2); gbc5.weightx = 1.0; gbc5.weighty = 0.0; gbc5.gridx = 1; gbc5.gridy = 3; gbc5.gridwidth = 1; GridBagConstraints gbc6 = new GridBagConstraints(); gbc6.fill = GridBagConstraints.HORIZONTAL; gbc6.anchor = GridBagConstraints.NORTHWEST; gbc6.insets = new Insets(12, 2, 2, 2); gbc6.weightx = 0.0; gbc6.weighty = 0.0; gbc6.gridx = 0; gbc6.gridy = 4; gbc6.gridwidth = 1; GridBagConstraints gbc7 = new GridBagConstraints(); gbc7.fill = GridBagConstraints.NONE; gbc7.anchor = GridBagConstraints.WEST; gbc7.insets = new Insets(12, 2, 2, 2); gbc7.weightx = 1.0; gbc7.weighty = 0.0; gbc7.gridx = 1; gbc7.gridy = 4; gbc7.gridwidth = 1; GridBagConstraints gbc8 = new GridBagConstraints(); gbc8.fill = GridBagConstraints.HORIZONTAL; gbc8.anchor = GridBagConstraints.NORTHWEST; gbc8.insets = new Insets(12, 2, 2, 2); gbc8.weightx = 0.0; gbc8.weighty = 0.0; gbc8.gridx = 0; gbc8.gridy = 5; gbc8.gridwidth = 1; GridBagConstraints gbc9 = new GridBagConstraints(); gbc9.fill = GridBagConstraints.NONE; gbc9.anchor = GridBagConstraints.WEST; gbc9.insets = new Insets(12, 2, 2, 2); gbc9.weightx = 1.0; gbc9.weighty = 0.0; gbc9.gridx = 1; gbc9.gridy = 5; gbc9.gridwidth = 1; GridBagConstraints gbc10 = new GridBagConstraints(); gbc10.fill = GridBagConstraints.HORIZONTAL; gbc10.anchor = GridBagConstraints.NORTHWEST; gbc10.insets = new Insets(26, 2, 2, 2); gbc10.weightx = 1.0; gbc10.weighty = 0.0; gbc10.gridx = 0; gbc10.gridy = 6; gbc10.gridwidth = 2; // Authentication methods authMethodsPanel.add(new JLabel("Authentication Methods"), gbc); jListAuths.setVisibleRowCount(5); authMethodsPanel.add(new JScrollPane(jListAuths), gbc2); allowAgentForwarding = new JCheckBox("Allow agent forwarding"); authMethodsPanel.add(allowAgentForwarding, gbc3); String options[] = { "Full", "Limited", "None" }; delegationOption = new JComboBox(options); delegationOption.setSelectedIndex(0); authMethodsPanel.add(new JLabel("Delegation Type:"), gbc4); authMethodsPanel.add(delegationOption, gbc5); String optionsP[] = { "Pre-RFC Impersonation", "RFC Impersonation", "Legacy" }; proxyOption = new JComboBox(optionsP); proxyOption.setSelectedIndex(0); authMethodsPanel.add(new JLabel("Proxy Type:"), gbc6); authMethodsPanel.add(proxyOption, gbc7); authMethodsPanel.add(new JLabel("Proxy Lifetime (hours):"), gbc8); proxyLength.setColumns(5); authMethodsPanel.add(proxyLength, gbc9); gbc.gridx = 0; proxySave = new JCheckBox("Save Grid Proxies to Disk"); authMethodsPanel.add(proxySave, gbc10); // IconWrapperPanel iconAuthMethodsPanel = new IconWrapperPanel( new ResourceIcon(SshToolsConnectionHostTab.class, AUTH_ICON), authMethodsPanel); // This panel JPanel mine = new JPanel(); mine.setLayout(new GridBagLayout()); mine.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.anchor = GridBagConstraints.NORTH; gbc.insets = new Insets(2, 2, 2, 2); gbc.weightx = 1.0; gbc.weighty = 0.0; gbc.gridx = 0; gbc.gridy = 0; mine.add(iconMainConnectionDetailsPanel, gbc); gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.anchor = GridBagConstraints.NORTH; gbc.weightx = 1.0; gbc.weighty = 0.0; gbc.gridx = 0; gbc.gridy = 1; gbc.insets = new Insets(20, 2, 2, 2); mine.add(iconAuthMethodsPanel, gbc); setLayout(new BorderLayout()); setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); this.add(mine, BorderLayout.NORTH); // Set up the values in the various components addAuthenticationMethods(); }
From source file:AccessibleScrollDemo.java
public AccessibleScrollDemo() { //Load the photograph into an image icon. ImageIcon david = new ImageIcon("images/youngdad.jpeg"); david.setDescription("Photograph of David McNabb in his youth."); //Create the row and column headers columnView = new Rule(Rule.HORIZONTAL, true); columnView.setPreferredWidth(david.getIconWidth()); columnView.getAccessibleContext().setAccessibleName("Column Header"); columnView.getAccessibleContext()/*from ww w. ja v a2 s. c o m*/ .setAccessibleDescription("Displays horizontal ruler for " + "measuring scroll pane client."); rowView = new Rule(Rule.VERTICAL, true); rowView.setPreferredHeight(david.getIconHeight()); rowView.getAccessibleContext().setAccessibleName("Row Header"); rowView.getAccessibleContext() .setAccessibleDescription("Displays vertical ruler for " + "measuring scroll pane client."); //Create the corners JPanel buttonCorner = new JPanel(); isMetric = new JToggleButton("cm", true); isMetric.setFont(new Font("SansSerif", Font.PLAIN, 11)); isMetric.setMargin(new Insets(2, 2, 2, 2)); isMetric.addItemListener(new UnitsListener()); isMetric.setToolTipText("Toggles rulers' unit of measure " + "between inches and centimeters."); buttonCorner.add(isMetric); //Use the default FlowLayout buttonCorner.getAccessibleContext().setAccessibleName("Upper Left Corner"); String desc = "Fills the corner of a scroll pane " + "with color for aesthetic reasons."; Corner lowerLeft = new Corner(); lowerLeft.getAccessibleContext().setAccessibleName("Lower Left Corner"); lowerLeft.getAccessibleContext().setAccessibleDescription(desc); Corner upperRight = new Corner(); upperRight.getAccessibleContext().setAccessibleName("Upper Right Corner"); upperRight.getAccessibleContext().setAccessibleDescription(desc); //Set up the scroll pane picture = new ScrollablePicture(david, columnView.getIncrement()); picture.setToolTipText(david.getDescription()); picture.getAccessibleContext().setAccessibleName("Scroll pane client"); JScrollPane pictureScrollPane = new JScrollPane(picture); pictureScrollPane.setPreferredSize(new Dimension(300, 250)); pictureScrollPane.setViewportBorder(BorderFactory.createLineBorder(Color.black)); pictureScrollPane.setColumnHeaderView(columnView); pictureScrollPane.setRowHeaderView(rowView); pictureScrollPane.setCorner(JScrollPane.UPPER_LEFT_CORNER, buttonCorner); pictureScrollPane.setCorner(JScrollPane.LOWER_LEFT_CORNER, lowerLeft); pictureScrollPane.setCorner(JScrollPane.UPPER_RIGHT_CORNER, upperRight); //Put it in this panel setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); add(pictureScrollPane); setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); }
From source file:com.choicemaker.cm.modelmaker.gui.panels.HoldVsAccuracyPlotPanel.java
JPanel getPanel(JTable table, String title) { JScrollPane pane = new JScrollPane(); pane.getViewport().add(table);//from ww w .j a va 2 s.c o m pane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(5, 10, 5, 5), BorderFactory.createLoweredBevelBorder())); JPanel panel = new JPanel(new BorderLayout()); panel.setBorder(BorderFactory.createTitledBorder(title)); panel.add(pane, BorderLayout.CENTER); return panel; }
From source file:edu.ku.brc.specify.utilapps.DataModelClassGenerator.java
/** * @param dataClass//from w w w . j a va 2 s . co m * @param tableId */ public DataModelClassGenerator(final Class<?> dataClass) { this.dataClass = dataClass; Class<?>[] baseClasses = { Boolean.class, Integer.class, Double.class, String.class, Float.class, Character.class, Short.class, Byte.class, BigDecimal.class, Date.class, Calendar.class }; for (Class<?> cls : baseClasses) { baseClassHash.put(cls.getSimpleName(), true); } int cnt = 0; for (Field field : dataClass.getDeclaredFields()) { if (field.getType() == String.class || Collection.class.isAssignableFrom(field.getType())) { cnt++; } } Font font = new Font("Courier", Font.PLAIN, 10); logArea = new JTextArea(); logArea.setFont(font); tableIdTxt = new JTextField(10); devTxt = new JTextField(10); PanelBuilder outer = new PanelBuilder(new FormLayout("p,2px,p,2px,f:p:g", "200px:g,4px,f:300px:g,4px,p")); PanelBuilder pb = new PanelBuilder(new FormLayout("p,2px,p,2px,l:p:g,2px,l:p", UIHelper.createDuplicateJGoodiesDef("p", "2px", cnt + 2))); CellConstraints cc = new CellConstraints(); pb.add(new JLabel("Table Id"), cc.xy(1, 1)); pb.add(tableIdTxt, cc.xywh(3, 1, 3, 1)); pb.add(new JLabel("Dev"), cc.xy(1, 3)); pb.add(devTxt, cc.xywh(3, 3, 3, 1)); int y = 5; for (Field field : dataClass.getDeclaredFields()) { if (field.getType() == String.class) { UIRow row = new UIRow(DataType.String, field); pb.add(new JLabel(field.getName()), cc.xy(1, y)); pb.add(row.getSizetxt(), cc.xywh(3, y, 1, 1)); y += 2; rows.add(row); fieldRowhash.put(field, row); } if (Collection.class.isAssignableFrom(field.getType())) { UIRow row = new UIRow(DataType.Set, field); pb.add(new JLabel(field.getName()), cc.xy(1, y)); pb.add(row.getSizetxt(), cc.xywh(3, y, 3, 1)); pb.add(new JLabel("(Set)", SwingConstants.LEFT), cc.xy(7, y)); y += 2; rows.add(row); fieldRowhash.put(field, row); } } JButton processBtn = UIHelper.createButton("Process"); JButton cancelBtn = UIHelper.createButton("Cancel"); processBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { process(); } }); cancelBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setVisible(false); } }); pb.getPanel().setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); JPanel panel = ButtonBarFactory.buildGrowingBar(new JButton[] { processBtn, cancelBtn }); outer.add(new JScrollPane(pb.getPanel(), ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED), cc.xywh(1, 1, 5, 1)); outer.add(new JScrollPane(logArea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED), cc.xywh(1, 3, 5, 1)); outer.add(panel, cc.xy(5, 5)); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); JPanel p = new JPanel(new BorderLayout()); p.add(outer.getPanel(), BorderLayout.CENTER); setContentPane(p); //setSize(500,500); pack(); setSize(500, getSize().height); }
From source file:edu.ku.brc.specify.toycode.UpdatesApp.java
protected void createUI() { baseBBP = new BrowseBtnPanel(baseTF, false, true); baseUpBBP = new BrowseBtnPanel(baseUpTF, false, true); macFullBBP = new BrowseBtnPanel(macFullTF, false, true); macUpBBP = new BrowseBtnPanel(macUpTF, false, true); outBBP = new BrowseBtnPanel(outTF, false, true); verSub1 = new JSpinner(); verSub2 = new JSpinner(); PanelBuilder pb = new PanelBuilder( new FormLayout("p,2px,p,f:p:g,p", createDuplicateJGoodiesDef("p:g", "4px", 7))); CellConstraints cc = new CellConstraints(); int y = 1;//w w w . j a v a 2 s . c o m pb.add(createLabel("Linux/Win Full:", SwingConstants.RIGHT), cc.xy(1, y)); pb.add(baseBBP, cc.xyw(3, y, 3)); y += 2; pb.add(createLabel("Linux/Win Update:", SwingConstants.RIGHT), cc.xy(1, y)); pb.add(baseUpBBP, cc.xyw(3, y, 3)); y += 2; pb.add(createLabel("Mac Full:", SwingConstants.RIGHT), cc.xy(1, y)); pb.add(macFullBBP, cc.xyw(3, y, 3)); y += 2; pb.add(createLabel("Mac Update:", SwingConstants.RIGHT), cc.xy(1, y)); pb.add(macUpBBP, cc.xyw(3, y, 3)); y += 2; pb.add(createLabel("Output:", SwingConstants.RIGHT), cc.xy(1, y)); pb.add(outBBP, cc.xyw(3, y, 3)); y += 2; updateBaseTF.setText("6.0.0"); pb.add(createLabel("Update Base Version:", SwingConstants.RIGHT), cc.xy(1, y)); pb.add(updateBaseTF, cc.xy(3, y)); y += 2; versionTF.setText("6"); verSub1.setValue(99); verSub2.setValue(99); PanelBuilder vpb = new PanelBuilder(new FormLayout("p,p,p:g,p,p:g,f:p:g", "p")); vpb.add(versionTF, cc.xy(1, 1)); vpb.add(createLabel("."), cc.xy(2, 1)); vpb.add(verSub1, cc.xy(3, 1)); vpb.add(createLabel("."), cc.xy(4, 1)); vpb.add(verSub2, cc.xy(5, 1)); pb.add(createLabel("New Version:", SwingConstants.RIGHT), cc.xy(1, y)); pb.add(vpb.getPanel(), cc.xyw(3, y, 1)); y += 2; PanelBuilder pb2 = new PanelBuilder(new FormLayout("p,2px,p,f:p:g,p", "p")); statusTF.setBackground(getBackground()); pb2.add(statusTF, cc.xyw(1, 1, 4)); pb2.add(mergeBtn, cc.xy(5, 1)); pb.getPanel().setBorder(BorderFactory.createEmptyBorder(14, 14, 1, 14)); setLayout(new BorderLayout()); add(pb.getPanel(), BorderLayout.CENTER); add(pb2.getPanel(), BorderLayout.SOUTH); try { XStream xstream = new XStream(); props = (Properties) xstream.fromXML(FileUtils.readFileToString(new File("props.init"))); } catch (Exception ex) { props = new Properties(); } baseTF.setText(props.getProperty("baseTF", "MacMedia/updates.xml.winlinfull.6.1.17")); baseUpTF.setText(props.getProperty("baseUpTF", "MacMedia/updates.xml.winlinupdate.6.1.17")); macFullTF.setText(props.getProperty("macFullTF", "MacMedia/updates_mac.xml")); macUpTF.setText(props.getProperty("macUpTF", "MacMedia/updates_mac_update.xml")); outTF.setText(props.getProperty("outTF", "MacMedia/updates.xml")); updateBaseTF.setText(props.getProperty("updateBaseTF", "6.0.0")); versionTF.setText(props.getProperty("versionTF", "6")); verSub1.setValue(Integer.parseInt(props.getProperty("subVer1", "1"))); verSub2.setValue(Integer.parseInt(props.getProperty("subVer2", "11"))); mergeBtn.addActionListener(new ActionListener() { /* (non-Javadoc) * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) */ @Override public void actionPerformed(ActionEvent e) { merge(baseTF.getText(), baseUpTF.getText(), macFullTF.getText(), macUpTF.getText(), outTF.getText(), updateBaseTF.getText(), versionTF.getText(), Integer.toString((Integer) verSub1.getValue()), Integer.toString((Integer) verSub2.getValue())); doSave(outTF.getText()); } }); }
From source file:com.chart.SwingChart.java
/** * Update background, tick and gridline colors * @param cfg cfg[0] Background, cfg[1] Chart background, cfg[2] y cfg[3] gridline *///from w w w. ja va2s .co m public void updateChartColors(String[] cfg) { strBackgroundColor = cfg[0]; for (Node le : legendFrame.getChildren()) { if (le instanceof LegendAxis) { le.setStyle("-fx-background-color:" + strBackgroundColor); ((LegendAxis) le).selected = false; } } chart.setBackgroundPaint(scene2awtColor(javafx.scene.paint.Color.web(strBackgroundColor))); chartPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4), BorderFactory.createLineBorder(scene2awtColor(javafx.scene.paint.Color.web(strBackgroundColor))))); chartPanel.setBackground(scene2awtColor(javafx.scene.paint.Color.web(strBackgroundColor))); legendFrame.setStyle("marco: " + strBackgroundColor + ";-fx-background-color: marco;"); strChartBackgroundColor = cfg[1]; ; plot.setBackgroundPaint(scene2awtColor(javafx.scene.paint.Color.web(strChartBackgroundColor))); for (Node le : legendFrame.getChildren()) { if (le instanceof LegendAxis) { le.setStyle("-fx-background-color:" + strBackgroundColor); ((LegendAxis) le).selected = false; for (Node nn : ((LegendAxis) le).getChildren()) { if (nn instanceof Label) { ((Label) nn).setStyle("fondo: " + strChartBackgroundColor + ";-fx-background-color: fondo;-fx-text-fill: ladder(fondo, white 49%, black 50%);-fx-padding:5px;-fx-background-radius: 5;-fx-font-size: " + String.valueOf(fontSize) + "px"); } } } } strGridlineColor = cfg[2]; ; plot.setDomainGridlinePaint(scene2awtColor(javafx.scene.paint.Color.web(strGridlineColor))); plot.setRangeGridlinePaint(scene2awtColor(javafx.scene.paint.Color.web(strGridlineColor))); strTickColor = cfg[3]; ; abcissaAxis.setLabelPaint(scene2awtColor(javafx.scene.paint.Color.web(strTickColor))); abcissaAxis.setTickLabelPaint(scene2awtColor(javafx.scene.paint.Color.web(strTickColor))); for (NumberAxis ejeOrdenada : AxesList) { ejeOrdenada.setLabelPaint(scene2awtColor(javafx.scene.paint.Color.web(strTickColor))); ejeOrdenada.setTickLabelPaint(scene2awtColor(javafx.scene.paint.Color.web(strTickColor))); } }