java.awt.BorderLayout Java Examples
The following examples show how to use
java.awt.BorderLayout.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MarkdownTextAreaWithPreview.java From meka with GNU General Public License v3.0 | 6 votes |
/** * Initializes the widgets. */ @Override protected void initGUI() { super.initGUI(); setLayout(new BorderLayout()); m_TabbedPane = new JTabbedPane(); add(m_TabbedPane, BorderLayout.CENTER); m_TextCode = new JTextArea(); m_TextCode.setFont(GUIHelper.getMonospacedFont()); m_TabbedPane.addTab("Write", new BaseScrollPane(m_TextCode)); m_PanePreview = new JEditorPane(); m_PanePreview.setEditable(false); m_PanePreview.setContentType("text/html"); m_TabbedPane.addTab("Preview", new BaseScrollPane(m_PanePreview)); m_TabbedPane.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { update(); } }); }
Example #2
Source File: ViewElementSliderDouble.java From Robot-Overlord-App with GNU General Public License v2.0 | 6 votes |
public ViewElementSliderDouble(RobotOverlord ro,DoubleEntity e,int top,int bottom) { super(ro); this.e=e; e.addObserver(this); field = new JSlider(); field.setMaximum(top); field.setMinimum(bottom); field.setMinorTickSpacing(1); field.setValue((int)Math.floor(e.get())); field.addChangeListener(this); field.addFocusListener(this); JLabel label = new JLabel(e.getName(),JLabel.LEADING); value = new JLabel(Integer.toString(field.getValue()),JLabel.RIGHT); Dimension dim = new Dimension(30,1); value.setMinimumSize(dim); value.setPreferredSize(dim); value.setMaximumSize(dim); panel.setLayout(new BorderLayout()); panel.add(label,BorderLayout.LINE_START); panel.add(field,BorderLayout.CENTER); panel.add(value,BorderLayout.LINE_END); }
Example #3
Source File: ProjectDialog.java From quickfix-messenger with BSD 3-Clause "New" or "Revised" License | 6 votes |
private void initComponents() { setLayout(new BorderLayout()); mainPanel = new JPanel(); mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); JScrollPane mainScrollPane = new JScrollPane(); mainScrollPane.setPreferredSize(new Dimension(300, 400)); add(mainScrollPane, BorderLayout.CENTER); projectTree = new JTree(); projectTree.setEditable(true); projectTree.setModel(new ProjectTreeModel(xmlProjectType)); projectTree.setCellRenderer(new ProjectTreeCellRenderer(frame)); projectTree.setCellEditor(new ProjectTreeCellEditor(projectTree)); projectTree.getSelectionModel().setSelectionMode( TreeSelectionModel.SINGLE_TREE_SELECTION); projectTree.addMouseListener(new ProjectTreeMouseListener(frame, projectTree)); projectTree.expandRow(1); mainScrollPane.getViewport().add(projectTree); pack(); }
Example #4
Source File: CssStylesPanel.java From netbeans with Apache License 2.0 | 6 votes |
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { splitPane = createSplitPane(); topPanel = new javax.swing.JPanel(); setLayout(new java.awt.BorderLayout()); splitPane.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); splitPane.setDividerSize(4); splitPane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT); topPanel.setLayout(new java.awt.BorderLayout()); splitPane.setTopComponent(topPanel); add(splitPane, java.awt.BorderLayout.CENTER); }
Example #5
Source File: MetaData.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
@Override protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) { super.initialize(type, oldInstance, newInstance, out); BorderLayout oldLayout = (BorderLayout) oldInstance; BorderLayout newLayout = (BorderLayout) newInstance; for (String constraints : CONSTRAINTS) { Object oldC = oldLayout.getLayoutComponent(constraints); Object newC = newLayout.getLayoutComponent(constraints); // Pending, assume any existing elements are OK. if (oldC != null && newC == null) { invokeStatement(oldInstance, "addLayoutComponent", new Object[] { oldC, constraints }, out); } } }
Example #6
Source File: AqlViewer.java From CQL with GNU Affero General Public License v3.0 | 6 votes |
private <X, Y> void viewAlgebraHelper(JComponent top, Algebra<Ty, En, Sym, Fk, Att, Gen, Sk, X, Y> algebra, JPanel out, JCheckBox simp, JSlider sl, Map<Pair<Boolean, Integer>, JScrollPane> cache) { boolean b = simp.isSelected(); int l = sl.getValue(); Pair<Boolean, Integer> p = new Pair<>(b, l); JScrollPane jsp = cache.get(p); if (jsp == null) { jsp = makeList2(algebra, b, l); cache.put(p, jsp); } out.removeAll(); out.add(jsp, BorderLayout.CENTER); out.add(top, BorderLayout.SOUTH); out.revalidate(); out.repaint(); }
Example #7
Source File: DebuggingViewComponent.java From netbeans with Apache License 2.0 | 6 votes |
private void createTreeView() { synchronized (lock) { releaseTreeView(); treeView = new DebugTreeView(); treeView.setRootVisible(false); treeView.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); treeView.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); treeView.getAccessibleContext().setAccessibleName(NbBundle.getMessage(DebuggingViewComponent.class, "DebuggingViewComponent.treeView.AccessibleContext.accessibleName")); // NOI18N treeView.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(DebuggingViewComponent.class, "DebuggingViewComponent.treeView.AccessibleContext.accessibleDescription")); // NOI18N treeView.getTree().addMouseWheelListener(this); treeView.addTreeExpansionListener(this); TreeModel model = treeView.getTree().getModel(); model.addTreeModelListener(this); treeView.getViewport().addChangeListener(this); treeView.getTree().setScrollsOnExpand(false); mainPanel.add(treeView, BorderLayout.CENTER); } }
Example #8
Source File: CTracesPanel.java From binnavi with Apache License 2.0 | 6 votes |
/** * Creates a new panel object. * * @param model Provides the active debugger. * @param graph Graph to trace. * @param traceProvider Provides the previously recorded traces. * @param graphPanel Panel for which the traces panel is shown. */ public CTracesPanel(final CDebugPerspectiveModel model, final ZyGraph graph, final ITraceListProvider traceProvider, final CGraphPanel graphPanel) { super(new BorderLayout()); m_model = model; m_graph = graph; m_traceProvider = traceProvider; m_graphPanel = graphPanel; m_innerPanel = new CDebugEventListPanel(traceProvider); add(m_innerPanel); m_traceTable = m_innerPanel.getTracesTable(); m_eventTable = m_innerPanel.getEventsTable(); m_traceTable.addMouseListener(new InternalTraceTableListener()); m_eventTable.addMouseListener(new InternalEventsTableListener()); }
Example #9
Source File: CGeneralSettingsPanel.java From binnavi with Apache License 2.0 | 6 votes |
/** * Creates a new general settings panel. */ public CGeneralSettingsPanel() { super(new BorderLayout()); idaDirectoryPanel = new FileChooserPanel( ConfigManager.instance().getGeneralSettings().getIdaDirectory(), new InternalIDAListener(), "...", TEXTFIELD_WIDTH, TEXTFIELD_HEIGHT, 0); logLevelBox = new JComboBox<String>(new String[] {"Off", "On", "Verbose"}); logLevelBox.setPreferredSize(new Dimension(TEXTFIELD_WIDTH, TEXTFIELD_HEIGHT)); final ScriptEngineManager manager = new ScriptEngineManager(); scriptingBox = new LanguageBox(manager); scriptingBox.setPreferredSize(new Dimension(TEXTFIELD_WIDTH, TEXTFIELD_HEIGHT)); final JPanel pMain = new JPanel(new BorderLayout()); pMain.add(createEditElementsPanel(), BorderLayout.NORTH); emailBox.setPreferredSize(new Dimension(TEXTFIELD_WIDTH, TEXTFIELD_HEIGHT)); add(pMain); }
Example #10
Source File: JToggleButtonJavaElementTest.java From marathonv5 with Apache License 2.0 | 6 votes |
@BeforeMethod public void showDialog() throws Throwable { JavaElementFactory.add(JToggleButton.class, JToggleButtonJavaElement.class); SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { frame = new JFrame(JToggleButtonJavaElementTest.class.getSimpleName()); frame.setName("frame-" + JToggleButtonJavaElementTest.class.getSimpleName()); frame.getContentPane().add(new CheckBoxDemo(), BorderLayout.CENTER); frame.getContentPane().add(new RadioButtonDemo(), BorderLayout.EAST); frame.pack(); frame.setAlwaysOnTop(true); frame.setVisible(true); } }); driver = new JavaAgent(); }
Example #11
Source File: MainPanel.java From ramus with GNU General Public License v3.0 | 6 votes |
private void setCurrentPanel(final int i) { currentPanel = i; { final IPanel panel = creator.getPanel(i); panel.get(); header.setDescription(panel.getDescribe()); this.panel.removeAll(); this.panel.add(panel.getComponent(), BorderLayout.CENTER); } panel.validate(); panel.repaint(); etap.setText(MessageFormat.format(Factory.getString("EtapOf"), new Object[]{Integer.toString(i + 1), Integer.toString(creator.getPanelCount())})); checkFinish(); }
Example #12
Source File: AudioTimestampSelector.java From GpsPrune with GNU General Public License v2.0 | 6 votes |
/** * Create the GUI components * @param inTopLabelKey key for description label at top * @param inLowerLabelKey key for description label at bottom, if any */ private void createComponents(String inTopLabelKey, String inLowerLabelKey) { setLayout(new BorderLayout()); add(new JLabel(I18nManager.getText(inTopLabelKey)), BorderLayout.NORTH); // panel for the radio buttons JPanel gridPanel = new JPanel(); gridPanel.setLayout(new GridLayout(0, 3, 15, 3)); final String[] keys = {"beginning", "middle", "end"}; ButtonGroup group = new ButtonGroup(); for (int i=0; i<3; i++) { _radios[i] = new JRadioButton(I18nManager.getText("dialog.correlate.timestamp." + keys[i])); group.add(_radios[i]); gridPanel.add(_radios[i]); } _radios[0].setSelected(true); add(gridPanel, BorderLayout.CENTER); if (inLowerLabelKey != null) { add(new JLabel(I18nManager.getText(inLowerLabelKey)), BorderLayout.SOUTH); } }
Example #13
Source File: SwingTools.java From rapidminer-studio with GNU Affero General Public License v3.0 | 6 votes |
/** * Creates a helpLabel and adds it to the labelPanel. The helpLabel shows a help icon. * * @param labelPanel * the panel which will be used to add the label. The panel needs to have a * {@link BorderLayout} as layout manager as the label will be added with the * constraint {@link BorderLayout#EAST}. * @return the helpLabel for further use * @since 7.0.0 */ public static JLabel initializeHelpLabel(JPanel labelPanel) { JPanel helpPanel = new JPanel(); helpPanel.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.NORTH; gbc.weightx = 1.0; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 3, 0, 0); final JLabel helpLabel = new JLabel(); helpLabel.setIcon(createIcon(HELP_ICON_PATH)); helpLabel.setFocusable(false); gbc.anchor = GridBagConstraints.CENTER; helpPanel.add(helpLabel, gbc); gbc.gridy += 1; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.weighty = 1.0; gbc.insets = new Insets(0, 0, 0, 0); helpPanel.add(new JLabel(), gbc); labelPanel.add(helpPanel, BorderLayout.EAST); return helpLabel; }
Example #14
Source File: MultiRepAnalysis.java From sc2gears with Apache License 2.0 | 6 votes |
/** * Creates and returns the Chat words tab. * @return the Chat words tab */ private JComponent createChatWordsTab() { final JPanel panel = new JPanel( new BorderLayout() ); panel.addComponentListener( new FirstShownListener() { @Override public void firstShown( final ComponentEvent event ) { final Vector< Vector< Object > > dataVector = new Vector< Vector< Object > >( chatWordsStatisticsMap.size() ); for ( final WordStatistics ws : chatWordsStatisticsMap.values() ) { final Vector< Object > row = new Vector< Object >( 6 ); row.add( ws.word ); row.add( ws.count ); row.add( ws.replays ); row.add( NullAwareComparable.getPercent( ws.replays * 100 / replaysIncludedInAnalysis ) ); row.add( Language.formatDate( ws.firstDate ) ); row.add( Language.formatDate( ws.lastDate ) ); dataVector.add( row ); } createStatisticsTableTab( panel, "module.multiRepAnal.tab.chatWords.info", new Object[] { chatWordsStatisticsMap.size() }, 0, new int[] { 1, 2, 0 }, dataVector, CHAT_WORDS_HEADER_NAME_VECTOR, new WordCloudTableInput( Language.getText( "module.multiRepAnal.tab.chatWords.title" ), 0, 1 ), null, null ); } } ); return panel; }
Example #15
Source File: RepositoryPanel.java From ghidra with Apache License 2.0 | 6 votes |
private JPanel createListPanel(String[] repositoryNames) { JPanel panel = new JPanel(new VerticalLayout(5)); panel.setBorder(BorderFactory.createTitledBorder("Choose Existing Repository")); existingRepButton = new GRadioButton("Existing Repository", (repositoryNames.length > 0)); existingRepButton.setEnabled(repositoryNames.length > 0); buttonGroup.add(existingRepButton); JPanel innerPanel = new JPanel(new BorderLayout()); JLabel label = new GDLabel("Repository Names", SwingConstants.LEFT); label.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 5)); innerPanel.add(label, BorderLayout.NORTH); listModel = new DefaultListModel<>(); for (String repositoryName : repositoryNames) { listModel.addElement(repositoryName); } nameList = new GList<>(listModel); nameList.setEnabled(existingRepButton.isSelected()); JScrollPane sp = new JScrollPane(nameList); innerPanel.add(sp); panel.add(existingRepButton); panel.add(innerPanel); return panel; }
Example #16
Source File: AddDependencyPanel.java From NBANDROID-V2 with Apache License 2.0 | 5 votes |
public AddDependencyPanel(List<Repository> repositories, List<String> currentPackages, List<MavenDependencyInfo> index) { initComponents(); this.repositories = repositories; this.currentPackages = currentPackages; for (String currentPackage : currentPackages) { StringTokenizer tok = new StringTokenizer(currentPackage, ":", false); if (tok.countTokens() > 1) { String grp = tok.nextToken(); String packg = tok.nextToken(); installedDependenciesInfos.add(new MavenDependencyInfo(MavenDependencyInfo.Type.MAVEN, grp, packg)); installedDependenciesInfos.add(new MavenDependencyInfo(MavenDependencyInfo.Type.GOOGLE, grp, packg)); installedDependenciesInfos.add(new MavenDependencyInfo(MavenDependencyInfo.Type.JCENTER, grp, packg)); } } Runnable runnable = new Runnable() { @Override public void run() { queryPanel = new QueryPanel(); resultsPanel.add(queryPanel, BorderLayout.CENTER); labelQ.setVisible(false); searchField.setVisible(false); labelHelp.setVisible(false); googleDependenciesInfos.addAll(index); jcenterPartial = false; googlePartial = false; mavenPartial = false; queryPanel.updateResults(); } }; SwingUtilities.invokeLater(runnable); }
Example #17
Source File: HTTP2SamplerGui.java From jmeter-http2-plugin with Apache License 2.0 | 5 votes |
private final JPanel getWebServerPanel() { JPanel webServerPanel = new HorizontalPanel(); final JPanel domainPanel = getDomainPanel(); final JPanel portPanel = getPortPanel(); webServerPanel.add(domainPanel, BorderLayout.CENTER); webServerPanel.add(portPanel, BorderLayout.EAST); return webServerPanel; }
Example #18
Source File: TexturePaintPrintingTest.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static void printTexture() { f = new JFrame("Texture Printing Test"); f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); final TexturePaintPrintingTest gpt = new TexturePaintPrintingTest(); Container c = f.getContentPane(); c.add(BorderLayout.CENTER, gpt); final JButton print = new JButton("Print"); print.addActionListener(new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { PrinterJob job = PrinterJob.getPrinterJob(); job.setPrintable(gpt); final boolean doPrint = job.printDialog(); if (doPrint) { try { job.print(); } catch (PrinterException ex) { throw new RuntimeException(ex); } } } }); c.add(print, BorderLayout.SOUTH); f.pack(); f.setVisible(true); }
Example #19
Source File: TransparentToolBar.java From visualvm with GNU General Public License v2.0 | 5 votes |
public TransparentToolBar(boolean horizontal) { this.horizontal = horizontal; setOpaque(false); setBorder(createToolBarBorder(horizontal)); if (needsPanel()) { // Toolbar is a JPanel (GTK) toolbar = null; setLayout(new BoxLayout(this, horizontal ? BoxLayout.X_AXIS : BoxLayout.Y_AXIS)); } else { // Toolbar is a JToolBar (default) toolbar = createToolBar(horizontal); toolbar.setBorder(BorderFactory.createEmptyBorder()); setLayout(new BorderLayout()); add(toolbar, BorderLayout.CENTER); } addHierarchyListener(new HierarchyListener() { public void hierarchyChanged(HierarchyEvent e) { if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0) { if (isShowing()) { removeHierarchyListener(this); for (Component c : getComponents()) { if (c instanceof AbstractButton) { listener.refresh((AbstractButton)c); } } } } } }); }
Example #20
Source File: ChartsPanel.java From javamelody with Apache License 2.0 | 5 votes |
ChartsPanel(RemoteCollector remoteCollector) { super(remoteCollector); final JLabel throbberLabel = new JLabel(THROBBER_ICON); add(throbberLabel, BorderLayout.NORTH); add(createButtonsPanel(), BorderLayout.CENTER); // SwingWorker pour afficher le reste de l'écran et pour éviter de faire attendre rien que pour les graphiques final SwingWorker<Map<String, byte[]>, Object> swingWorker = new SwingWorker<Map<String, byte[]>, Object>() { @Override protected Map<String, byte[]> doInBackground() throws IOException { return getRemoteCollector().collectJRobins(CHART_WIDTH, CHART_HEIGHT); } @Override protected void done() { try { final Map<String, byte[]> jrobins = get(); final JPanel mainJRobinsPanel = createJRobinPanel(jrobins); remove(throbberLabel); add(mainJRobinsPanel, BorderLayout.NORTH); revalidate(); } catch (final Exception e) { showException(e); remove(throbberLabel); } } }; swingWorker.execute(); }
Example #21
Source File: EnvironmentViewSupport.java From visualvm with GNU General Public License v2.0 | 5 votes |
private void initComponents() { setLayout(new BorderLayout()); setOpaque(false); area = new HTMLTextArea("<nobr><b>Progress:</b> reading data...</nobr>"); area.setBorder(BorderFactory.createEmptyBorder(14, 8, 14, 8)); add(new ScrollableContainer(area), BorderLayout.CENTER); add(HTMLTextAreaSearchUtils.createSearchPanel(area), BorderLayout.SOUTH); }
Example #22
Source File: LinearGradientPrintingTest.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public static void createUI() { f = new JFrame("LinearGradient Printing Test"); f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); final LinearGradientPrintingTest gpt = new LinearGradientPrintingTest(); Container c = f.getContentPane(); c.add(BorderLayout.CENTER, gpt); final JButton print = new JButton("Print"); print.addActionListener(new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { PrinterJob job = PrinterJob.getPrinterJob(); job.setPrintable(gpt); final boolean doPrint = job.printDialog(); if (doPrint) { try { job.print(); } catch (PrinterException ex) { throw new RuntimeException(ex); } } } }); c.add(print, BorderLayout.SOUTH); f.pack(); f.setVisible(true); }
Example #23
Source File: Launcher.java From osp with GNU General Public License v3.0 | 5 votes |
/** * Displays the standard tabbed pane view. */ protected void showTabbedPaneView() { contentPane.removeAll(); if(navigationVisible&&!(this instanceof LaunchBuilder)) { contentPane.add(navbar, BorderLayout.NORTH); } contentPane.add(tabbedPane, BorderLayout.CENTER); frame.validate(); refreshGUI(); frame.repaint(); }
Example #24
Source File: PubSamplerUI.java From mqtt-jmeter with Apache License 2.0 | 5 votes |
private void init() { setLayout(new BorderLayout()); setBorder(makeBorder()); add(makeTitlePanel(), BorderLayout.NORTH); JPanel mainPanel = new VerticalPanel(); add(mainPanel, BorderLayout.CENTER); mainPanel.add(createPubOption()); mainPanel.add(createPayload()); }
Example #25
Source File: CResultsPanel.java From binnavi with Apache License 2.0 | 5 votes |
/** * Creates a new results panel. * * @param graph The graph where highlighting happens. * @param model Provides the results to display. */ public CResultsPanel(final ZyGraph graph, final CSpecialInstructionsModel model) { super(new BorderLayout()); m_table = new CResultsTable(graph, model); add(new JScrollPane(m_table)); }
Example #26
Source File: ProgressDialogControllerImpl.java From bigtable-sql with Apache License 2.0 | 5 votes |
/** * @see net.sourceforge.squirrel_sql.client.update.gui.installer.ProgressDialogController#showProgressDialog(java.lang.String, * java.lang.String, int) */ public void showProgressDialog(final String title, final String msg, final int total) { s_log.info("showing progress dialog"); GUIUtils.processOnSwingEventThread(new Runnable() { public void run() { currentDialog = new JDialog((Frame) null, title); currentMessage = new JLabel(msg); detailMessage = new JLabel("..."); currentProgressBar = new JProgressBar(0, total - 1); JPanel panel = new JPanel(new BorderLayout()); JPanel messagePanel = new JPanel(new GridLayout(2,1)); messagePanel.add(currentMessage); messagePanel.add(detailMessage); panel.add(messagePanel, BorderLayout.CENTER); panel.add(currentProgressBar, BorderLayout.SOUTH); currentDialog.getContentPane().add(panel); currentDialog.setSize(300, 100); GUIUtils.centerWithinScreen(currentDialog); currentDialog.setVisible(true); } }, true); }
Example #27
Source File: FieldConfigWKT.java From sldeditor with GNU General Public License v3.0 | 5 votes |
/** Creates the ui. */ @Override public void createUI() { FieldPanel fieldPanel = createFieldPanel(0, ""); fieldPanel.setLayout(new BorderLayout()); wktPanel = new WKTDetails(this); fieldPanel.add(wktPanel, BorderLayout.CENTER); Dimension panelSize = wktPanel.getPanelSize(); fieldPanel.setPreferredSize(panelSize); }
Example #28
Source File: PercentageInputComponent.java From chipster with MIT License | 5 votes |
/** * Creates a new PercentageInputComponent. * * @param param The PercentageParameter to be controlled. * @param enabled * @param parameterPanel The ParameterPanel to which this component is to * be placed. */ public PercentageInputComponent( PercentageParameter param, ParameterPanel parameterPanel) { super(parameterPanel); this.param = param; this.state = ParameterInputComponent.INPUT_IS_INITIALIZED; /** * The eventual minimum and maximum values of the percentage parameter * may be something between 0 and 100, but the slider will always show * a scale from 0 to 100, even if some values would be illegal. * The illegality is (hopefully) clearly indicated. */ int initValue = 0; if (param.getIntegerValue() != null) { initValue = param.getIntegerValue().intValue(); } this.slider = new JSlider(JSlider.HORIZONTAL, 0, 100, initValue); slider.setMajorTickSpacing(50); slider.setMinorTickSpacing(10); slider.setPaintTicks(true); slider.setPaintLabels(false); slider.addChangeListener(this); slider.addFocusListener(this); // Normal width minus label width slider.setPreferredSize(new Dimension(ParameterInputComponent.PREFERED_WIDTH - 40, 40)); this.numberLabel = new JLabel( param.getIntegerValue() + "%", SwingConstants.CENTER); numberLabel.setPreferredSize(new Dimension(40, 30)); numberLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); this.add(slider, BorderLayout.WEST); this.add(numberLabel, BorderLayout.EAST); }
Example #29
Source File: OortGuiAdvancedPanel.java From owltools with BSD 3-Clause "New" or "Revised" License | 5 votes |
private void createCatalogXMLPanel(GBHelper pos) { panel.add(new JLabel("catalog.xml File"), pos.nextRow().indentLeft(DEFAULT_INDENT).width(3)); addRowGap(this.panel, pos.nextRow(), 5); JPanel catalogXMLInputPanel = new JPanel(new BorderLayout(10, 0)); catalogXMLInputPanel.add(catalogXMLField, BorderLayout.CENTER); final JButton selectFileButton = new JButton("Select File"); catalogXMLInputPanel.add(selectFileButton, BorderLayout.LINE_END); final SelectDialog fileDialog = SelectDialog.getFileSelector(frame, SelectDialog.LOAD, ".", "Select catalog.xml dialog", "XML files", new String[]{"xml"}); selectFileButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { fileDialog.show(); String selected = fileDialog.getSelectedCanonicalPath(); if (selected != null) { catalogXMLField.setText(selected); } } }); panel.add(catalogXMLInputPanel, pos.nextRow().nextCol().nextCol().width(2).expandW().indentRight(DEFAULT_INDENT).fill()); addRowGap(this.panel, pos.nextRow(), 10); }
Example #30
Source File: DefaultProjectRenamePanel.java From netbeans with Apache License 2.0 | 5 votes |
private static ProgressBar create(JComponent progress) { ProgressBar instance = new ProgressBar(); instance.setLayout(new BorderLayout()); instance.label = new JLabel(" "); //NOI18N instance.label.setBorder(new EmptyBorder(0, 0, 2, 0)); instance.add(instance.label, BorderLayout.NORTH); instance.add(progress, BorderLayout.CENTER); return instance; }