List of usage examples for javax.swing BorderFactory createTitledBorder
public static TitledBorder createTitledBorder(Border border)
From source file:openlr.mapviewer.coding.ui.AbstractCodingOptionsDialog.java
/** * Sets up the form and sets the values from the given configuration. * /*w w w . ja v a 2s.c o m*/ * @param config * The configuration to initialize the form with * @return The panel containing the form */ private JComponent buildForm(final FileConfiguration config) { JPanel formPanel = new JPanel(); JScrollPane scrollPane = new JScrollPane(formPanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); formPanel.setLayout(new MigLayout("insets 0", "[grow][]", "")); SortedMap<String, List<ConfigEntry>> topicsToKeyValuesMap = buildConfigurationMap(config); for (Map.Entry<String, List<ConfigEntry>> entry : topicsToKeyValuesMap.entrySet()) { String topic = entry.getKey(); List<ConfigEntry> configEntries = entry.getValue(); if (configEntries.size() == 1) { // it is a single property, just put a single line of label and // value directly on the formPanel addLabelledFields(configEntries, formPanel); } else { // multiple sub properties, create a separate panel collecting // all elements JPanel topicPanel = new JPanel(); topicPanel.setLayout(new MigLayout("insets 0", "[grow][]", "")); topicPanel.setBorder(BorderFactory.createTitledBorder(topic)); addLabelledFields(configEntries, topicPanel); formPanel.add(topicPanel, "span, grow, wrap"); } } formPanel.invalidate(); return scrollPane; }
From source file:info.puzz.trackprofiler.gui.TrackProfilerFrame.java
private JPanel getJPanel1() { if (jPanel1 == null) { jPanel1 = new JPanel(); BorderLayout jPanel1Layout = new BorderLayout(); jPanel1.setLayout(jPanel1Layout); jPanel1.setBorder(BorderFactory.createTitledBorder("")); //$NON-NLS-1$ jPanel1.add(getChartPanel());//ww w. java2 s . c o m } return jPanel1; }
From source file:com.employee.scheduler.common.swingui.SolverAndPersistenceFrame.java
private JComponent createQuickOpenPanel(JPanel panel, String title, List<Action> quickOpenActionList, List<File> fileList) { panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); refreshQuickOpenPanel(panel, quickOpenActionList, fileList); JScrollPane scrollPane = new JScrollPane(panel); scrollPane.getVerticalScrollBar().setUnitIncrement(25); scrollPane.setMinimumSize(new Dimension(100, 80)); // Size fits into screen resolution 1024*768 scrollPane.setPreferredSize(new Dimension(180, 200)); JPanel titlePanel = new JPanel(new BorderLayout()); titlePanel.add(scrollPane, BorderLayout.CENTER); titlePanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2), BorderFactory.createTitledBorder(title))); return titlePanel; }
From source file:com.web.vehiclerouting.optaplanner.common.swingui.SolverAndPersistenceFrame.java
private JComponent createQuickOpenPanel(List<Action> quickOpenActionList, List<File> fileList, String title) { JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); if (fileList.isEmpty()) { JLabel noneLabel = new JLabel("None"); noneLabel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); panel.add(noneLabel);/*from w ww .j a v a 2 s .c o m*/ } else { for (File file : fileList) { Action quickOpenAction = new QuickOpenAction(file); quickOpenActionList.add(quickOpenAction); JButton quickOpenButton = new JButton(quickOpenAction); quickOpenButton.setHorizontalAlignment(SwingConstants.LEFT); quickOpenButton.setMargin(new Insets(0, 0, 0, 0)); panel.add(quickOpenButton); } } JScrollPane scrollPane = new JScrollPane(panel); scrollPane.getVerticalScrollBar().setUnitIncrement(25); scrollPane.setMinimumSize(new Dimension(100, 80)); // Size fits into screen resolution 1024*768 scrollPane.setPreferredSize(new Dimension(180, 200)); JPanel titlePanel = new JPanel(new BorderLayout()); titlePanel.add(scrollPane, BorderLayout.CENTER); titlePanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2), BorderFactory.createTitledBorder(title))); return titlePanel; }
From source file:com.mirth.connect.client.ui.attachments.RegexAttachmentDialog.java
private void initComponents() { regularExpressionPanel = new JPanel(new MigLayout("novisualpadding, hidemode 3, fill, insets 0")); regularExpressionPanel.setBackground(UIConstants.BACKGROUND_COLOR); regularExpressionPanel.setBorder(BorderFactory.createTitledBorder("Regular Expressions")); regexExampleTextField = new JTextField(); regexExampleTextField.setText("(?:OBX\\|(?:[^|]*\\|){4}(?:[^|^]*\\^){4})([^|^\\r\\n]*)(?:[|^\\r\\n]|$)"); regexExampleTextField.setEditable(false); regexExampleTextField.setBorder(null); regexExampleTextField.setOpaque(false); regexTable = new MirthTable(); regexTable.setModel(new RefreshTableModel(new Object[] { "Regular Expression", "MIME Type" }, 0)); regexTable.setDragEnabled(false);/*w w w .j av a 2s . c o m*/ regexTable.setRowSelectionAllowed(true); regexTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); regexTable.setRowHeight(UIConstants.ROW_HEIGHT); regexTable.setFocusable(true); regexTable.setOpaque(true); regexTable.getTableHeader().setReorderingAllowed(false); regexTable.setEditable(true); regexTable.setSortable(false); if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) { regexTable.setHighlighters(HighlighterFactory.createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR, UIConstants.BACKGROUND_COLOR)); } regexTable.getColumnExt(0).setMinWidth(105); regexTable.getColumnExt(0).setPreferredWidth(350); regexTable.getColumnExt(0).setToolTipText( "<html>The regular expression that will be used to match and extract attachments.<br>If capturing groups are used, only the last group will be extracted.</html>"); regexTable.getColumnExt(1).setMinWidth(63); regexTable.getColumnExt(1).setToolTipText( "The MIME type of the extracted attachment data. Source map variables may be used here."); regexTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent evt) { regexDeleteButton.setEnabled(regexTable.getSelectedRow() >= 0); } }); regexTableScrollPane = new JScrollPane(regexTable); regexNewButton = new JButton("New"); regexNewButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { regexNewButtonActionPerformed(); } }); regexDeleteButton = new JButton("Delete"); regexDeleteButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { regexDeleteButtonActionPerformed(); } }); regexDeleteButton.setEnabled(false); stringReplacementPanel = new JPanel(new MigLayout("novisualpadding, hidemode 3, insets 0")); stringReplacementPanel.setBackground(UIConstants.BACKGROUND_COLOR); stringReplacementPanel.setBorder(BorderFactory.createTitledBorder("String Replacement")); stringReplacementLabel = new JLabel(); stringReplacementLabel.setText( "<html>Replace strings on the matched data before storing. Do not use regular expressions in these fields or surround with quotes.<br>\nExample: Use <b>\\\\X0D0A\\\\</b> and <b>\\r\\n</b> to replace \\X0D0A\\ with actual CRLF characters. </html>"); inboundReplacementTable = new MirthTable(); inboundScrollPane = new JScrollPane(); inboundScrollPane.setViewportView(inboundReplacementTable); outboundReplacementTable = new MirthTable(); outboundScrollPane = new JScrollPane(); outboundScrollPane.setViewportView(outboundReplacementTable); inboundButtonPanel = new JPanel(new MigLayout("novisualpadding, hidemode 3, insets 0", "", "")); inboundButtonPanel.setBackground(UIConstants.BACKGROUND_COLOR); inboundNewButton = new JButton("New"); inboundNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { inboundNewButtonActionPerformed(evt); } }); inboundDeleteButton = new JButton("Delete"); inboundDeleteButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { inboundDeleteButtonActionPerformed(evt); } }); outboundButtonPanel = new JPanel(new MigLayout("novisualpadding, hidemode 3, insets 0", "", "")); outboundButtonPanel.setBackground(UIConstants.BACKGROUND_COLOR); outboundNewButton = new JButton("New"); outboundNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { outboundNewButtonActionPerformed(evt); } }); outboundDeleteButton = new JButton("Delete"); outboundDeleteButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { outboundDeleteButtonActionPerformed(evt); } }); separator = new JSeparator(); closeButton = new JButton("Close"); closeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { closeButtonActionPerformed(evt); } }); }
From source file:instance.gui.InstanceGUI.java
private void createBandwidthPanel() { bandwidthPanel = new JPanel(); bandwidthPanel.setBorder(BorderFactory.createTitledBorder("Bandwidth")); bandwidthPanel.setLayout(new GridLayout()); }
From source file:FontChooser.java
private JPanel createPreviewPanel() { final JPanel pnl = new JPanel(new BorderLayout()); pnl.setBorder(BorderFactory.createTitledBorder("PreviewTitle")); Dimension prefSize = _previewLbl.getPreferredSize(); prefSize.height = 50;/* w w w . j a v a 2 s. c o m*/ _previewLbl.setPreferredSize(prefSize); pnl.add(_previewLbl, BorderLayout.CENTER); setupPreviewLabel(); return pnl; }
From source file:edu.uci.ics.jung.samples.PerspectiveTransformerDemo.java
/** * create an instance of a simple graph with controls to * demo the zoom and perspective features. * //from w w w .jav a2 s . c o m */ @SuppressWarnings("serial") public PerspectiveTransformerDemo() { // create a simple graph for the demo graph = TestGraphs.getOneComponentGraph(); graphLayout = new FRLayout<String, Number>(graph); ((FRLayout<String, Number>) graphLayout).setMaxIterations(1000); Dimension preferredSize = new Dimension(600, 600); Map<String, Point2D> map = new HashMap<String, Point2D>(); Transformer<String, Point2D> vlf = TransformerUtils.mapTransformer(map); grid = this.generateVertexGrid(map, preferredSize, 25); gridLayout = new StaticLayout<String, Number>(grid, vlf, preferredSize); final VisualizationModel<String, Number> visualizationModel = new DefaultVisualizationModel<String, Number>( graphLayout, preferredSize); vv = new VisualizationViewer<String, Number>(visualizationModel, preferredSize); PickedState<Number> pes = vv.getPickedEdgeState(); vv.getRenderContext() .setEdgeDrawPaintTransformer(new PickableEdgePaintTransformer<Number>(pes, Color.black, Color.red)); vv.getRenderContext().setVertexShapeTransformer(new Transformer<String, Shape>() { public Shape transform(String v) { return new Rectangle2D.Float(-10, -10, 20, 20); } }); vv.setBackground(Color.white); // add a listener for ToolTips vv.setVertexToolTipTransformer(new ToStringLabeller<String>()); Container content = getContentPane(); GraphZoomScrollPane gzsp = new GraphZoomScrollPane(vv); content.add(gzsp); /** * the regular graph mouse for the normal view */ final DefaultModalGraphMouse<Number, Number> graphMouse = new DefaultModalGraphMouse<Number, Number>(); vv.setGraphMouse(graphMouse); viewSupport = new PerspectiveViewTransformSupport<String, Number>(vv); layoutSupport = new PerspectiveLayoutTransformSupport<String, Number>(vv); final ScalingControl scaler = new CrossoverScalingControl(); JButton plus = new JButton("+"); plus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1.1f, vv.getCenter()); } }); JButton minus = new JButton("-"); minus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scaler.scale(vv, 0.9f, vv.getCenter()); } }); final JSlider horizontalSlider = new JSlider(-120, 120, 0) { /* (non-Javadoc) * @see javax.swing.JComponent#getPreferredSize() */ @Override public Dimension getPreferredSize() { return new Dimension(80, super.getPreferredSize().height); } }; final JSlider verticalSlider = new JSlider(-120, 120, 0) { /* (non-Javadoc) * @see javax.swing.JComponent#getPreferredSize() */ @Override public Dimension getPreferredSize() { return new Dimension(super.getPreferredSize().width, 80); } }; verticalSlider.setOrientation(JSlider.VERTICAL); final ChangeListener changeListener = new ChangeListener() { public void stateChanged(ChangeEvent e) { int vval = -verticalSlider.getValue(); int hval = horizontalSlider.getValue(); Dimension d = vv.getSize(); PerspectiveTransform pt = null; pt = PerspectiveTransform.getQuadToQuad(vval, hval, d.width - vval, -hval, d.width + vval, d.height + hval, -vval, d.height - hval, 0, 0, d.width, 0, d.width, d.height, 0, d.height); viewSupport.getPerspectiveTransformer().setPerspectiveTransform(pt); layoutSupport.getPerspectiveTransformer().setPerspectiveTransform(pt); vv.repaint(); } }; horizontalSlider.addChangeListener(changeListener); verticalSlider.addChangeListener(changeListener); JPanel perspectivePanel = new JPanel(new BorderLayout()); JPanel perspectiveCenterPanel = new JPanel(new BorderLayout()); perspectivePanel.setBorder(BorderFactory.createTitledBorder("Perspective Controls")); final JButton center = new JButton("Center"); center.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { horizontalSlider.setValue(0); verticalSlider.setValue(0); } }); ButtonGroup radio = new ButtonGroup(); JRadioButton normal = new JRadioButton("None"); normal.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { boolean selected = e.getStateChange() == ItemEvent.SELECTED; if (selected) { if (viewSupport != null) { viewSupport.deactivate(); } if (layoutSupport != null) { layoutSupport.deactivate(); } } center.setEnabled(!selected); horizontalSlider.setEnabled(!selected); verticalSlider.setEnabled(!selected); } }); final JRadioButton perspectiveView = new JRadioButton("In View"); perspectiveView.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { viewSupport.activate(e.getStateChange() == ItemEvent.SELECTED); } }); final JRadioButton perspectiveModel = new JRadioButton("In Layout"); perspectiveModel.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { layoutSupport.activate(e.getStateChange() == ItemEvent.SELECTED); } }); radio.add(normal); radio.add(perspectiveModel); radio.add(perspectiveView); normal.setSelected(true); ButtonGroup graphRadio = new ButtonGroup(); JRadioButton graphButton = new JRadioButton("Graph"); graphButton.setSelected(true); graphButton.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { visualizationModel.setGraphLayout(graphLayout); vv.repaint(); } } }); JRadioButton gridButton = new JRadioButton("Grid"); gridButton.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { visualizationModel.setGraphLayout(gridLayout); vv.repaint(); } } }); graphRadio.add(graphButton); graphRadio.add(gridButton); JPanel modePanel = new JPanel(new GridLayout(2, 1)); modePanel.setBorder(BorderFactory.createTitledBorder("Display")); modePanel.add(graphButton); modePanel.add(gridButton); JMenuBar menubar = new JMenuBar(); menubar.add(graphMouse.getModeMenu()); gzsp.setCorner(menubar); Container controls = new JPanel(new BorderLayout()); JPanel zoomControls = new JPanel(new GridLayout(2, 1)); zoomControls.setBorder(BorderFactory.createTitledBorder("Zoom")); JPanel perspectiveControls = new JPanel(new GridLayout(3, 1)); zoomControls.add(plus); zoomControls.add(minus); perspectiveControls.add(normal); perspectiveControls.add(perspectiveModel); perspectiveControls.add(perspectiveView); controls.add(zoomControls, BorderLayout.WEST); controls.add(modePanel); perspectivePanel.add(perspectiveControls, BorderLayout.WEST); perspectiveCenterPanel.add(horizontalSlider, BorderLayout.SOUTH); perspectivePanel.add(verticalSlider, BorderLayout.EAST); perspectiveCenterPanel.add(center); perspectivePanel.add(perspectiveCenterPanel); controls.add(perspectivePanel, BorderLayout.EAST); content.add(controls, BorderLayout.SOUTH); }
From source file:uk.co.petertribble.solview.explorer.ArcStatPanel.java
/** * Craete a new ArcStatPanel, to display ZFS ARC statistics graphically. * * @param jkstat a JKstat object//from w w w . ja va2s. c o m * @param interval the desired display update interval in seconds */ public ArcStatPanel(JKstat jkstat, int interval) { this.jkstat = jkstat; setDelay(interval); // FIXME all labels need to be localized // create a main panel setLayout(new SpringLayout()); // initialise the datasets totalCacheHitsDataset = new DefaultPieDataset(); currentCacheHitsDataset = new DefaultPieDataset(); totalCacheHitsByTypeDataset = new DefaultPieDataset(); currentCacheHitsByTypeDataset = new DefaultPieDataset(); totalCacheMissesByTypeDataset = new DefaultPieDataset(); currentCacheMissesByTypeDataset = new DefaultPieDataset(); // initialise the pie charts // args: title, dataset, legend?, tooltips?, urls? JFreeChart totalCacheChart = ChartFactory.createPieChart("Total Cache Hits By List", totalCacheHitsDataset, false, true, false); JFreeChart currentCacheChart = ChartFactory.createPieChart("Current Cache Hits By List", currentCacheHitsDataset, false, true, false); JFreeChart totalCacheHitsByTypeChart = ChartFactory.createPieChart("Total Cache Hits By Type", totalCacheHitsByTypeDataset, false, true, false); JFreeChart currentCacheHitsByTypeChart = ChartFactory.createPieChart("Current Cache Hits By Type", currentCacheHitsByTypeDataset, false, true, false); JFreeChart totalCacheMissesByTypeChart = ChartFactory.createPieChart("Total Cache Misses By Type", totalCacheMissesByTypeDataset, false, true, false); JFreeChart currentCacheMissesByTypeChart = ChartFactory.createPieChart("Current Cache Misses By Type", currentCacheMissesByTypeDataset, false, true, false); /* * The overall layout is simple: at the top are the overall size * statistics. Then the percentages for hits/misses/types for the * cache are shown below. */ JPanel infoPanel = new JPanel(new GridLayout(0, 2)); JPanel hitPanel = new JPanel(new GridLayout(0, 2)); JPanel cacheByListPanel = new JPanel(new GridLayout(1, 2)); JPanel cacheHitByTypePanel = new JPanel(new GridLayout(1, 2)); JPanel cacheMissByTypePanel = new JPanel(new GridLayout(1, 2)); // cache hit rates, in a separate panel with bars. arc_hit_bar = new JProgressBar(0, 100); arc_hit_bar.setStringPainted(true); demand_hit_bar = new JProgressBar(0, 100); demand_hit_bar.setStringPainted(true); pf_hit_bar = new JProgressBar(0, 100); pf_hit_bar.setStringPainted(true); mdemand_hit_bar = new JProgressBar(0, 100); mdemand_hit_bar.setStringPainted(true); mpf_hit_bar = new JProgressBar(0, 100); mpf_hit_bar.setStringPainted(true); hitPanel.add(new JLabel("ARC hit rate")); hitPanel.add(arc_hit_bar); hitPanel.add(new JLabel("Demand data hit rate")); hitPanel.add(demand_hit_bar); hitPanel.add(new JLabel("Prefetch data hit rate")); hitPanel.add(pf_hit_bar); hitPanel.add(new JLabel("Demand metadata hit rate")); hitPanel.add(mdemand_hit_bar); hitPanel.add(new JLabel("Prefetch metadata hit rate")); hitPanel.add(mpf_hit_bar); hitPanel.setBorder(BorderFactory.createTitledBorder("Cache Hit Rates")); Dimension dchart = new Dimension(320, 240); ChartPanel cp1a = new ChartPanel(totalCacheChart); cp1a.setPreferredSize(dchart); ChartPanel cp1b = new ChartPanel(currentCacheChart); cp1b.setPreferredSize(dchart); ChartPanel cp2a = new ChartPanel(totalCacheHitsByTypeChart); cp2a.setPreferredSize(dchart); ChartPanel cp2b = new ChartPanel(currentCacheHitsByTypeChart); cp2b.setPreferredSize(dchart); ChartPanel cp3a = new ChartPanel(totalCacheMissesByTypeChart); cp3a.setPreferredSize(dchart); ChartPanel cp3b = new ChartPanel(currentCacheMissesByTypeChart); cp3b.setPreferredSize(dchart); infoPanel.add(new JLabel("Current size")); arc_size_label = new JLabel(); infoPanel.add(arc_size_label); infoPanel.add(new JLabel("Target size")); target_size_label = new JLabel(); infoPanel.add(target_size_label); infoPanel.add(new JLabel("Min size")); arc_min_size_label = new JLabel(); infoPanel.add(arc_min_size_label); infoPanel.add(new JLabel("Max size")); arc_max_size_label = new JLabel(); infoPanel.add(arc_max_size_label); infoPanel.add(new JLabel("MRU size")); mru_size_label = new JLabel(); infoPanel.add(mru_size_label); infoPanel.add(new JLabel("MFU size")); mfu_size_label = new JLabel(); infoPanel.add(mfu_size_label); infoPanel.setBorder(BorderFactory.createTitledBorder("Statistics")); cacheByListPanel.add(cp1a); cacheByListPanel.add(cp1b); cacheHitByTypePanel.add(cp2a); cacheHitByTypePanel.add(cp2b); cacheMissByTypePanel.add(cp3a); cacheMissByTypePanel.add(cp3b); add(infoPanel); add(hitPanel); add(cacheByListPanel); add(cacheHitByTypePanel); add(cacheMissByTypePanel); SpringUtilities.makeCompactGrid(this, 5, 1, 3, 3, 3, 3); update(); startLoop(); }
From source file:instance.gui.InstanceGUI.java
private void createDataSection() { dataSection = new JPanel(); dataSection.setBorder(BorderFactory.createTitledBorder("Data block(s)")); dataSection.setLayout(new BoxLayout(dataSection, BoxLayout.Y_AXIS)); createNumberOfRequestsLabel(dataSection); createCurrentTransfers(dataSection); createRequestQueue(dataSection);//from w ww.jav a 2 s . c om createDataBlockTable(dataSection); infoTab.add(dataSection); }