List of usage examples for javax.swing BorderFactory createTitledBorder
public static TitledBorder createTitledBorder(Border border)
From source file:eu.delving.sip.base.ReportChartHelper.java
public static JComponent createLinkChart(DataSet dataSet, String prefix, Map<RecDef.Check, LinkFile.LinkStats> linkStatsMap) { JPanel p = new JPanel(new GridLayout(0, 1)); for (Map.Entry<RecDef.Check, LinkFile.LinkStats> entry : linkStatsMap.entrySet()) { JPanel pp = new JPanel(new GridLayout(1, 0)); pp.setBorder(BorderFactory.createTitledBorder(entry.getKey().toString())); for (Map.Entry<String, PieDataset> datasetEntry : entry.getValue().createPies().entrySet()) { JFreeChart chart = ChartFactory.createRingChart(datasetEntry.getKey(), datasetEntry.getValue(), true, false, Locale.getDefault()); RingPlot plot = (RingPlot) chart.getPlot(); plot.setLabelGenerator(null); plot.setNoDataMessage("No data available"); plot.setSectionDepth(0.34999999999999998D); plot.setCircular(true);//from ww w . j a v a 2 s. c om plot.setLabelGap(0.02D); pp.add(new ChartPanel(chart)); } p.add(pp); } return p; }
From source file:medsavant.enrichment.app.OntologyAggregatePanel.java
public OntologyAggregatePanel(String page) { super(page);/*from www . ja va 2s . c o m*/ setLayout(new GridBagLayout()); chooser = new JComboBox(OntologyListItem.DEFAULT_ITEMS); chooser.setMaximumSize(new Dimension(400, chooser.getMaximumSize().height)); progress = new JProgressBar(); progress.setPreferredSize(new Dimension(600, progress.getMaximumSize().height)); progress.setStringPainted(true); JPanel banner = new JPanel(); banner.setLayout(new GridBagLayout()); banner.setBackground(new Color(245, 245, 245)); banner.setBorder(BorderFactory.createTitledBorder("Ontology")); tree = new TreeTable(); GridBagConstraints gbc = new GridBagConstraints(); gbc.weightx = 1.0; gbc.anchor = GridBagConstraints.WEST; banner.add(chooser, gbc); gbc.anchor = GridBagConstraints.EAST; banner.add(progress, gbc); gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.weightx = 1.0; gbc.weighty = 0.0; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.anchor = GridBagConstraints.NORTH; add(banner, gbc); gbc.weighty = 1.0; gbc.fill = GridBagConstraints.BOTH; add(new JScrollPane(tree), gbc); chooser.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (termFetcher != null) { termFetcher.cancel(true); termFetcher = null; } recalculate(); } }); tree.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { if (SwingUtilities.isRightMouseButton(e)) { createPopup().show(e.getComponent(), e.getX(), e.getY()); } } }); }
From source file:ExtendedDnDDemo.java
private JPanel createList() { DefaultListModel listModel = new DefaultListModel(); listModel.addElement("List 0"); listModel.addElement("List 1"); listModel.addElement("List 2"); listModel.addElement("List 3"); listModel.addElement("List 4"); listModel.addElement("List 5"); listModel.addElement("List 6"); listModel.addElement("List 7"); listModel.addElement("List 8"); JList list = new JList(listModel); list.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); JScrollPane scrollPane = new JScrollPane(list); scrollPane.setPreferredSize(new Dimension(400, 100)); list.setDragEnabled(true);//from w w w . j av a 2 s . c o m list.setTransferHandler(new ListTransferHandler()); JPanel panel = new JPanel(new BorderLayout()); panel.add(scrollPane, BorderLayout.CENTER); panel.setBorder(BorderFactory.createTitledBorder("List")); return panel; }
From source file:fr.irit.smac.libs.tooling.plot.server.AgentPlotChart.java
private ChartPanel getChartPanel() { // we put the chart into a panel if (chartPanel == null) { chartPanel = new ChartPanel(getJFreeChart()); border = BorderFactory.createTitledBorder(name); chartPanel.setBorder(border);//from w w w .j a va 2s . co m // default size chartPanel.setPreferredSize(new Dimension(300, 300)); } return chartPanel; }
From source file:org.nees.rpi.vis.ui.XYChartPanelProxy.java
public XYChartPanelProxy(int width, int height) { selectionGroup = new SelectionGroup(); selectionGroup.setSelection(true);/*from w ww .ja v a 2s . c o m*/ dataSet = new XYSeriesCollection(); chart = ChartFactory.createXYLineChart(null, domainAxisLabel, rangeAxisLabel, dataSet, PlotOrientation.VERTICAL, true, true, false); chart.setBackgroundPaint(Color.WHITE); chart.getLegend().setPosition(RectangleEdge.RIGHT); chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(width, height)); chartPanel.setFillZoomRectangle(true); chartPanel.setHorizontalAxisTrace(true); chartPanel.setVerticalAxisTrace(true); toolPanel = new JPanel(); toolPanel.setOpaque(false); toolPanel.setLayout(new BoxLayout(toolPanel, BoxLayout.Y_AXIS)); toolPanel.setBorder(BorderFactory.createTitledBorder("Plot Control")); toolPanel.setPreferredSize(new Dimension(155, 100)); chartAreaPanel = new JPanel(); chartAreaPanel.setOpaque(true); chartAreaPanel.setBackground(Color.white); chartAreaPanel.setLayout(new BorderLayout()); chartAreaPanel.add(chartPanel, BorderLayout.CENTER); chartAreaPanel.add(toolPanel, BorderLayout.WEST); initClearSelectionButton(toolPanel); initResetPlotButton(toolPanel); initSaveToImageButton(toolPanel); initShowAsProfilePlotButton(toolPanel); }
From source file:org.mn.z80util.testbench.MZ80TestBench.java
private void createAndShowGUI() { // See above//from w ww . j a v a2 s.c o m if (!SwingUtilities.isEventDispatchThread()) { System.err.println("Attempting to construct the GUI from outside " + "of event dispatch thread! This is an error. Please check " + "your code modifications."); System.exit(1); } /* Initializes the GUI frame */ GUI = new JFrame("Mikko's Z80 Testbench - (C) Mikko Nummelin, 2009"); GUI.setLayout(new BorderLayout()); GUI.setIconImage(LogoFactory.createLogo()); GUI.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); leftPanel = new JPanel(); leftPanel.setLayout(new GridLayout(3, 1)); // The first processor information firstProcessorPanel = new JPanel(); firstProcessorPanel.setLayout(new GridLayout(2, 1)); firstProcessorPanel.setBorder(BorderFactory.createTitledBorder("Processor 1")); firstProcessorPanel.add(new JLabel(processor1.getClass().getName())); firstProcessorStatus = new JLabel("-"); firstProcessorPanel.add(firstProcessorStatus); leftPanel.add(firstProcessorPanel); // The second processor information secondProcessorPanel = new JPanel(); secondProcessorPanel.setLayout(new GridLayout(2, 1)); secondProcessorPanel.setBorder(BorderFactory.createTitledBorder("Processor 2")); secondProcessorPanel.add(new JLabel(processor2.getClass().getName())); secondProcessorStatus = new JLabel("-"); secondProcessorPanel.add(secondProcessorStatus); leftPanel.add(secondProcessorPanel); // The progress bar panel progressBarPanel = new JPanel(); progressBarPanel.setLayout(new GridLayout(3, 1)); progressBarPanel.setBorder(BorderFactory.createTitledBorder("Progress")); progressBar = new JProgressBar(0, 0x6bf); progressBarPanel.add(progressBar); statusMessage = new JLabel("-"); progressBarPanel.add(statusMessage); executedCommand = new JLabel("-"); progressBarPanel.add(executedCommand); leftPanel.add(progressBarPanel); GUI.add(leftPanel, BorderLayout.WEST); // The action button panel actionPanel = new JPanel(); okCancelButton = new JButton("Cancel"); okCancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.exit(0); } }); actionPanel.add(okCancelButton); GUI.add(actionPanel, BorderLayout.SOUTH); // The image panel imagePanel = new JPanel(); java.net.URL imgURL = getClass().getResource("/Z80-pinout.png"); img = new ImageIcon(imgURL); imagePanel.add(new JLabel(img)); GUI.add(imagePanel, BorderLayout.EAST); GUI.pack(); GUI.setResizable(false); GUI.setVisible(true); }
From source file:com.xilinx.kintex7.ThermoPlot.java
public ChartPanel getChart() { ChartPanel chartpanel = new ChartPanel(chart); chartpanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(""), BorderFactory.createRaisedBevelBorder())); return chartpanel; }
From source file:events.ListSelectionDemo.java
public ListSelectionDemo() { super(new BorderLayout()); String[] listData = { "one", "two", "three", "four", "five", "six", "seven" }; String[] columnNames = { "French", "Spanish", "Italian" }; list = new JList(listData); listSelectionModel = list.getSelectionModel(); listSelectionModel.addListSelectionListener(new SharedListSelectionHandler()); JScrollPane listPane = new JScrollPane(list); JPanel controlPane = new JPanel(); String[] modes = { "SINGLE_SELECTION", "SINGLE_INTERVAL_SELECTION", "MULTIPLE_INTERVAL_SELECTION" }; final JComboBox comboBox = new JComboBox(modes); comboBox.setSelectedIndex(2);/*from w w w .j ava 2s.c o m*/ comboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String newMode = (String) comboBox.getSelectedItem(); if (newMode.equals("SINGLE_SELECTION")) { listSelectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); } else if (newMode.equals("SINGLE_INTERVAL_SELECTION")) { listSelectionModel.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); } else { listSelectionModel.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); } output.append("----------" + "Mode: " + newMode + "----------" + newline); } }); controlPane.add(new JLabel("Selection mode:")); controlPane.add(comboBox); //Build output area. output = new JTextArea(1, 10); output.setEditable(false); JScrollPane outputPane = new JScrollPane(output, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); //Do the layout. JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); add(splitPane, BorderLayout.CENTER); JPanel topHalf = new JPanel(); topHalf.setLayout(new BoxLayout(topHalf, BoxLayout.LINE_AXIS)); JPanel listContainer = new JPanel(new GridLayout(1, 1)); listContainer.setBorder(BorderFactory.createTitledBorder("List")); listContainer.add(listPane); topHalf.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5)); topHalf.add(listContainer); //topHalf.add(tableContainer); topHalf.setMinimumSize(new Dimension(100, 50)); topHalf.setPreferredSize(new Dimension(100, 110)); splitPane.add(topHalf); JPanel bottomHalf = new JPanel(new BorderLayout()); bottomHalf.add(controlPane, BorderLayout.PAGE_START); bottomHalf.add(outputPane, BorderLayout.CENTER); //XXX: next line needed if bottomHalf is a scroll pane: //bottomHalf.setMinimumSize(new Dimension(400, 50)); bottomHalf.setPreferredSize(new Dimension(450, 135)); splitPane.add(bottomHalf); }
From source file:ListCutPaste.java
public ListCutPaste() { super(new BorderLayout()); lh = new ListTransferHandler(); JPanel panel = new JPanel(new GridLayout(1, 3)); DefaultListModel list1Model = new DefaultListModel(); list1Model.addElement("alpha"); list1Model.addElement("beta"); list1Model.addElement("gamma"); list1Model.addElement("delta"); list1Model.addElement("epsilon"); list1Model.addElement("zeta"); JList list1 = new JList(list1Model); list1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); JScrollPane sp1 = new JScrollPane(list1); sp1.setPreferredSize(new Dimension(400, 100)); list1.setDragEnabled(true);/* w w w .j a v a 2 s . co m*/ list1.setTransferHandler(lh); list1.setDropMode(DropMode.ON_OR_INSERT); setMappings(list1); JPanel pan1 = new JPanel(new BorderLayout()); pan1.add(sp1, BorderLayout.CENTER); pan1.setBorder(BorderFactory.createTitledBorder("Greek Alphabet")); panel.add(pan1); DefaultListModel list2Model = new DefaultListModel(); list2Model.addElement("uma"); list2Model.addElement("dois"); list2Model.addElement("tres"); list2Model.addElement("quatro"); list2Model.addElement("cinco"); list2Model.addElement("seis"); JList list2 = new JList(list2Model); list2.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); list2.setDragEnabled(true); JScrollPane sp2 = new JScrollPane(list2); sp2.setPreferredSize(new Dimension(400, 100)); list2.setTransferHandler(lh); list2.setDropMode(DropMode.INSERT); setMappings(list2); JPanel pan2 = new JPanel(new BorderLayout()); pan2.add(sp2, BorderLayout.CENTER); pan2.setBorder(BorderFactory.createTitledBorder("Portuguese Numbers")); panel.add(pan2); DefaultListModel list3Model = new DefaultListModel(); list3Model.addElement("adeen"); list3Model.addElement("dva"); list3Model.addElement("tri"); list3Model.addElement("chyetirye"); list3Model.addElement("pyat"); list3Model.addElement("shest"); JList list3 = new JList(list3Model); list3.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); list3.setDragEnabled(true); JScrollPane sp3 = new JScrollPane(list3); sp3.setPreferredSize(new Dimension(400, 100)); list3.setTransferHandler(lh); list3.setDropMode(DropMode.ON); setMappings(list3); JPanel pan3 = new JPanel(new BorderLayout()); pan3.add(sp3, BorderLayout.CENTER); pan3.setBorder(BorderFactory.createTitledBorder("Russian Numbers")); panel.add(pan3); setPreferredSize(new Dimension(500, 200)); add(panel, BorderLayout.CENTER); }
From source file:com.google.code.facebook.graph.sna.applet.ImageEdgeLabelDemo.java
public ImageEdgeLabelDemo() { // create a simple graph for the demo graph = new DirectedSparseMultigraph<Number, Number>(); createGraph(VERTEX_COUNT);// w w w. jav a2 s . c o m FRLayout<Number, Number> layout = new FRLayout<Number, Number>(graph); layout.setMaxIterations(100); vv = new VisualizationViewer<Number, Number>(layout, new Dimension(400, 400)); vv.getRenderContext().setEdgeDrawPaintTransformer( new PickableEdgePaintTransformer<Number>(vv.getPickedEdgeState(), Color.black, Color.cyan)); vv.setBackground(Color.white); vv.getRenderContext().setVertexLabelRenderer(new DefaultVertexLabelRenderer(Color.cyan)); vv.getRenderContext().setEdgeLabelRenderer(new DefaultEdgeLabelRenderer(Color.cyan)); vv.getRenderContext().setEdgeLabelTransformer(new Transformer<Number, String>() { URL url = getClass().getResource("/images/lightning-s.gif"); public String transform(Number input) { return "<html><img src=" + url + " height=10 width=21>"; } }); // add a listener for ToolTips vv.setVertexToolTipTransformer(new ToStringLabeller<Number>()); vv.setEdgeToolTipTransformer(new ToStringLabeller<Number>()); Container content = getContentPane(); final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv); content.add(panel); final DefaultModalGraphMouse<Number, Number> graphMouse = new DefaultModalGraphMouse<Number, Number>(); vv.setGraphMouse(graphMouse); vv.addKeyListener(graphMouse.getModeKeyListener()); 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, 1 / 1.1f, vv.getCenter()); } }); JComboBox modeBox = graphMouse.getModeComboBox(); JPanel modePanel = new JPanel(); modePanel.setBorder(BorderFactory.createTitledBorder("Mouse Mode")); modePanel.add(modeBox); JPanel scaleGrid = new JPanel(new GridLayout(1, 0)); scaleGrid.setBorder(BorderFactory.createTitledBorder("Zoom")); JPanel controls = new JPanel(); scaleGrid.add(plus); scaleGrid.add(minus); controls.add(scaleGrid); controls.add(modePanel); content.add(controls, BorderLayout.SOUTH); }