List of usage examples for javax.swing BorderFactory createCompoundBorder
public static CompoundBorder createCompoundBorder(Border outsideBorder, Border insideBorder)
From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.corretor_eventos.PanelCorretorEventos.java
/** * Cria uma borda com ttulo dentro dos padres * // w w w. j av a 2s.co m * @param titulo * @return */ private Border criaBorda(String titulo) { Border bordaLinhaPreta = BorderFactory.createLineBorder(new Color(0, 0, 0), 1); Border borda = BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(5, 5, 10, 5), new TitledBorder(bordaLinhaPreta, titulo)); Border bordaFinal = BorderFactory.createCompoundBorder(borda, BorderFactory.createEmptyBorder(0, 4, 4, 5)); return bordaFinal; }
From source file:net.aepik.alasca.gui.ldap.SchemaObjectEditorFrame.java
/** * Build frame.//w ww . j a v a2s . co m */ private void build() { setTitle("Proprits de l'objet " + objetSchema.getId()); setSize(700, 400); setResizable(false); setLocationRelativeTo(mainFrame); if (mainFrame != null) setIconImage(mainFrame.getIconImage()); // - Panel bouton du bas - JPanel boutonsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); boutonsPanel.add(boutonOk); boutonsPanel.add(boutonAnnuler); // - Description - JTextArea textAreaValues = new JTextArea("Vous pouvez apporter des modifications sur les paramtres" + " de cet objet d'identifiant " + objetSchema.getId() + ". Les" + " modifications apportes des paramtres non-cochs ne" + " seront pas prises en compte."); textAreaValues.setEditable(false); textAreaValues.setLineWrap(true); textAreaValues.setWrapStyleWord(true); textAreaValues.setFont((new JLabel()).getFont()); textAreaValues.setBorder(BorderFactory.createEmptyBorder(7, 8, 7, 8)); textAreaValues.setBackground((new JLabel()).getBackground()); // - La table des valeurs - // Correction : Tri alphabtique des valeurs Enumeration<String> k = values.keys(); String[] keys = new String[values.size()]; for (int i = 0; i < keys.length; i++) keys[i] = k.nextElement(); Arrays.sort(keys); JPanel colonne1 = new JPanel(new GridLayout(keys.length, 1)); JPanel colonne2 = new JPanel(new GridLayout(keys.length, 1)); // Enumeration<JComponent> l = labels.elements(); // Enumeration<JComponent> v = values.elements(); // Enumeration<String> k = values.keys(); // JPanel colonne1 = new JPanel( new GridLayout( values.size(), 1 ) ); // JPanel colonne2 = new JPanel( new GridLayout( values.size(), 1 ) ); for (int i = 0; keys != null && i < keys.length; i++) { // while( l.hasMoreElements() && v.hasMoreElements() && k.hasMoreElements() ) { String key = keys[i]; JComponent label = labels.get(key); JComponent value = values.get(key); JCheckBox checkbox = valuesPresent.get(key); // String key = k.nextElement(); // JComponent label = l.nextElement(); // JComponent value = v.nextElement(); // JCheckBox checkbox = valuesPresent.get( key ); if (!value.isEnabled() && value instanceof JTextField) { //value.setEnabled( true ); JButton b = new JButton("..."); b.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createMatteBorder(0, 5, 0, 0, Color.white), b.getBorder())); b.addActionListener(new SchemaValueEditorLauncher(b, (JTextField) value, objetSchema, key)); JPanel tmp = new JPanel(new BorderLayout()); tmp.add(value, BorderLayout.CENTER); tmp.add(b, BorderLayout.EAST); tmp.setOpaque(false); value = tmp; } JPanel panelTmp1 = new JPanel(new BorderLayout()); panelTmp1.add(checkbox, BorderLayout.WEST); panelTmp1.add(label, BorderLayout.CENTER); panelTmp1.setBorder(BorderFactory.createEmptyBorder(2, 0, 2, 3)); colonne1.add(panelTmp1); JPanel panelTmp2 = new JPanel(new BorderLayout()); panelTmp2.add(value, BorderLayout.CENTER); panelTmp2.setBorder(BorderFactory.createEmptyBorder(2, 3, 2, 3)); colonne2.add(panelTmp2); checkbox.setOpaque(false); label.setOpaque(false); value.setOpaque(false); panelTmp1.setOpaque(false); panelTmp2.setOpaque(false); } JPanel tablePanel = new JPanel(new BorderLayout()); tablePanel.add(colonne1, BorderLayout.WEST); tablePanel.add(colonne2, BorderLayout.EAST); tablePanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); colonne1.setOpaque(false); colonne2.setOpaque(false); tablePanel.setOpaque(false); JPanel tablePanelContainer = new JPanel(new BorderLayout()); tablePanelContainer.add(tablePanel, BorderLayout.NORTH); tablePanelContainer.setBackground(Color.white); JList tmpForBorderList = new JList(); JScrollPane tmpForBorderScroller = new JScrollPane(tmpForBorderList); JScrollPane tableScroller = new JScrollPane(tablePanelContainer); //tableScroller.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS ); tableScroller.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(5, 6, 1, 6), BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(" Listes des paramtres "), BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(0, 5, 5, 5), tmpForBorderScroller.getBorder())))); // - Organisation gnrale - JPanel mainPanel = new JPanel(new BorderLayout()); mainPanel.add(textAreaValues, BorderLayout.NORTH); mainPanel.add(tableScroller, BorderLayout.CENTER); JPanel mainPanelContainer = new JPanel(new BorderLayout()); mainPanelContainer.add(mainPanel, BorderLayout.CENTER); mainPanelContainer.add(boutonsPanel, BorderLayout.SOUTH); mainPanelContainer.setBorder(BorderFactory.createEmptyBorder(2, 1, 1, 1)); getContentPane().add(mainPanelContainer); // - Listeners - addWindowListener(this); boutonOk.addActionListener(this); boutonAnnuler.addActionListener(this); }
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 w w .j a v a 2s . co 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:src.gui.LifelinePanel.java
/** * this method created and set the graph for showing the timing diagram based * on the variable diagram// w w w. ja v a 2s . com */ public void buildLifeLine() { //1. get type and context String dtype = diagram.getChildText("type"); String context = diagram.getChildText("context"); //the frame and lifeline nodes Element frame = diagram.getChild("frame"); String durationStr = frame.getChildText("duration"); lifelineName = ""; String objectClassName = ""; String yAxisName = ""; float lastIntervalDuration = 0; //condition lifeline if (dtype.equals("condition")) { //check if the context is a action if (context.equals("action")) { //get action/operator Element operatorRef = diagram.getChild("action"); Element operator = null; try { XPath path = new JDOMXPath( "elements/classes/class[@id='" + operatorRef.getAttributeValue("class") + "']/operators/operator[@id='" + operatorRef.getAttributeValue("id") + "']"); operator = (Element) path.selectSingleNode(project); } catch (JaxenException e2) { e2.printStackTrace(); } if (operator != null) { // System.out.println(operator.getChildText("name")); //System.out.println("Life line id "+ lifeline.getAttributeValue("id")); //get the object (can be a parametr. literal, or object) Element objRef = lifeline.getChild("object"); Element attrRef = lifeline.getChild("attribute"); //get object class Element objClass = null; try { XPath path = new JDOMXPath( "elements/classes/class[@id='" + objRef.getAttributeValue("class") + "']"); objClass = (Element) path.selectSingleNode(project); } catch (JaxenException e2) { e2.printStackTrace(); } Element attribute = null; try { XPath path = new JDOMXPath( "elements/classes/class[@id='" + attrRef.getAttributeValue("class") + "']/attributes/attribute[@id='" + attrRef.getAttributeValue("id") + "']"); attribute = (Element) path.selectSingleNode(project); } catch (JaxenException e2) { e2.printStackTrace(); } yAxisName = attribute.getChildText("name"); //if (objClass!=null) Element object = null; //check what is this object (parameterof an action, object, literal) if (objRef.getAttributeValue("element").equals("parameter")) { //get parameter in the action try { XPath path = new JDOMXPath( "parameters/parameter[@id='" + objRef.getAttributeValue("id") + "']"); object = (Element) path.selectSingleNode(operator); } catch (JaxenException e2) { e2.printStackTrace(); } String parameterStr = object.getChildText("name"); lifelineName = parameterStr + ":" + objClass.getChildText("name"); objectClassName = parameterStr + ":" + objClass.getChildText("name"); } // //set suround border Border etchedBdr = BorderFactory.createEtchedBorder(); Border titledBdr = BorderFactory.createTitledBorder(etchedBdr, "lifeline(" + lifelineName + ")"); //Border titledBdr = BorderFactory.createTitledBorder(etchedBdr, ""); Border emptyBdr = BorderFactory.createEmptyBorder(10, 10, 10, 10); Border compoundBdr = BorderFactory.createCompoundBorder(titledBdr, emptyBdr); this.setBorder(compoundBdr); //Boolean attribute if (attribute.getChildText("type").equals("1")) { lifelineName += " - " + attribute.getChildText("name"); Element timeIntervals = lifeline.getChild("timeIntervals"); XYSeriesCollection dataset = new XYSeriesCollection(); XYSeries series = new XYSeries("Boolean"); for (Iterator<Element> it1 = timeIntervals.getChildren().iterator(); it1.hasNext();) { Element timeInterval = it1.next(); boolean insertPoint = true; Element durationConstratint = timeInterval.getChild("durationConstratint"); Element lowerbound = durationConstratint.getChild("lowerbound"); Element upperbound = durationConstratint.getChild("upperbound"); Element value = timeInterval.getChild("value"); //Add for both lower and upper bound //lower bound float lowerTimePoint = 0; try { lowerTimePoint = Float.parseFloat(lowerbound.getAttributeValue("value")); lastIntervalDuration = lowerTimePoint; } catch (Exception e) { insertPoint = false; } //System.out.println(" > point x= "+ Float.toString(lowerTimePoint)+ " , y= "+ lowerbound.getAttributeValue("value")); if (insertPoint) { series.add(lowerTimePoint, (value.getText().equals("false") ? 0 : 1)); } //upper bound float upperTimePoint = 0; try { upperTimePoint = Float.parseFloat(upperbound.getAttributeValue("value")); lastIntervalDuration = upperTimePoint; } catch (Exception e) { insertPoint = false; } //System.out.println(" > point x= "+ Float.toString(upperTimePoint)+ " , y= "+ lowerbound.getAttributeValue("value")); if (insertPoint && upperTimePoint != lowerTimePoint) { series.add(upperTimePoint, (value.getText().equals("false") ? 0 : 1)); } } dataset.addSeries(series); //chart = ChartFactory.createXYStepChart(lifelineName, "time", "value", dataset, PlotOrientation.VERTICAL, false, true, false); chart = ChartFactory.createXYStepChart(attribute.getChildText("name"), "time", "value", dataset, PlotOrientation.VERTICAL, false, true, false); chart.setBackgroundPaint(Color.WHITE); XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.WHITE); NumberAxis domainAxis = new NumberAxis("Time"); domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); domainAxis.setAutoRangeIncludesZero(false); //set timing ruler if (durationStr.trim().equals("")) { if (lastIntervalDuration > 0) domainAxis.setUpperBound(lastIntervalDuration + timingRulerAdditional); else domainAxis.setUpperBound(10.0); } else { try { float dur = Float.parseFloat(durationStr); if (dur >= lastIntervalDuration) { domainAxis.setUpperBound(dur + timingRulerAdditional); } else { domainAxis.setUpperBound(lastIntervalDuration + timingRulerAdditional); } } catch (Exception e) { if (lastIntervalDuration > 0) domainAxis.setUpperBound(lastIntervalDuration + timingRulerAdditional); else domainAxis.setUpperBound(10.0); } } plot.setDomainAxis(domainAxis); String[] values = { "false", "true" }; //SymbolAxis rangeAxis = new SymbolAxis("Values", values); SymbolAxis rangeAxis = new SymbolAxis(yAxisName, values); plot.setRangeAxis(rangeAxis); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new Dimension(chartPanel.getSize().width, 175)); JLabel title = new JLabel("<html><b><u>" + objectClassName + "</u></b></html>"); title.setBackground(Color.WHITE); this.add(title, BorderLayout.WEST); this.add(chartPanel, BorderLayout.CENTER); } } } //if this is a possible sequence of action being modeled to a condition else if (context.equals("general")) { } } else if (dtype.equals("state")) { } }
From source file:gov.llnl.lc.infiniband.opensm.plugin.gui.chart.AdvancedXY_PlotPanel.java
private void initChart(XY_PlotPanel pPanel) { this.plotPanel = pPanel; this.chartPanel = pPanel.getChartPanel(); if (pPanel instanceof SimpleXY_PlotPanel) { this.setTitle(((SimpleXY_PlotPanel) pPanel).getTitle()); }//from w w w .j a v a 2 s . co m JFreeChart chart = chartPanel.getChart(); XYPlot plot = (XYPlot) chart.getPlot(); // how many data sets will there be (may not exist yet, cause swing worker may still be constructing them) int numRows = 2; // enough for counts, and delta counts if ((XY_PlotType.ADV_PORT_UTIL_PLUS.equals(getType()))) numRows = 4; boolean includeExtra = numRows > MAX_DATASETS / 2 ? true : false; int rowSize = includeExtra ? MAX_DS_SIZE : MAX_DS_SIZE / 2 + 19; // extra for padding NumDataSets = numRows; // build the table model from the data sets, then build the table and slider // see "chartProgress()" method chart.addProgressListener(this); this.chartPanel.setPreferredSize(new java.awt.Dimension(750, 300)); this.chartPanel.setDomainZoomable(true); this.chartPanel.setRangeZoomable(true); Border border = BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4), BorderFactory.createEtchedBorder()); this.chartPanel.setBorder(border); add(this.chartPanel); JPanel dashboard = new JPanel(new BorderLayout()); dashboard.setPreferredSize(new Dimension(400, rowSize)); dashboard.setBorder(BorderFactory.createEmptyBorder(0, 4, 4, 4)); this.model = new XY_PlotTableModel(numRows); // initialize the model, and table, here // this.model.setValueAt("name", 0, 1); this.model.setValueAt(new Double("0.00"), 0, 1); this.model.setValueAt(new Double("0.00"), 0, 2); // this.model.setValueAt("units", 0, 3); JTable table = new JTable(this.model); // the columns are name, time, value, units. both name and units are strings // so need special renderers for time and value TableCellRenderer renderer1 = new DateCellRenderer(new SimpleDateFormat("HH:mm:ss")); TableCellRenderer renderer2 = new NumberCellRenderer(); table.getColumnModel().getColumn(1).setCellRenderer(renderer1); table.getColumnModel().getColumn(2).setCellRenderer(renderer2); JScrollPane scroller = new JScrollPane(table); dashboard.add(scroller); this.slider = new JSlider(0, 100, 10); this.slider.addChangeListener(this); dashboard.add(this.slider, BorderLayout.SOUTH); add(dashboard, BorderLayout.SOUTH); // XYPlot plot = (XYPlot) chart.getPlot(); plot.setDomainCrosshairLockedOnData(true); plot.setRangeCrosshairVisible(false); plot.setDomainCrosshairVisible(true); }
From source file:net.schweerelos.parrot.ui.GraphViewComponent.java
public GraphViewComponent() { super();//from w ww . j av a 2 s . c o m setLayout(new GridBagLayout()); setBorder( BorderFactory.createCompoundBorder( BorderFactory.createEmptyBorder(PADDING_NODE_BORDER, PADDING_NODE_BORDER, PADDING_NODE_BORDER, PADDING_NODE_BORDER), BorderFactory.createLoweredBevelBorder())); layout = new NodeWrapperPersistentLayoutImpl(new CircleLayout<NodeWrapper, NodeWrapper>( new DirectedSparseMultigraph<NodeWrapper, NodeWrapper>())); vv = new VisualizationViewer<NodeWrapper, NodeWrapper>(layout); setupRenderContext(vv); view = new JScrollPane(vv); add(view, CONTENT_CONSTRAINTS); }
From source file:be.ac.ua.comp.scarletnebula.gui.ServerCellRenderer.java
private JPanel createServerPanel(final Server server, final JList list, final int index, final boolean isSelected) { final JXPanel p = new JXPanel(); p.setLayout(new GridBagLayout()); final Color background = Colors.alpha(getBackgroundColor(list, index, isSelected), 0.4f); p.setBackground(background);/*from w ww . j ava 2 s . c o m*/ Color color1 = Colors.White.color(0.5f); Color color2 = Colors.Gray.color(0.95f); final Point2D start = new Point2D.Float(0, 0); Point2D stop = new Point2D.Float(150, 500); if (server != null && !server.sshWillFail() && server.getServerStatistics() != null) { final ServerStatisticsManager manager = server.getServerStatistics(); final Datastream.WarnLevel warnlevel = manager.getHighestWarnLevel(); if (warnlevel == Datastream.WarnLevel.HIGH) { color1 = Colors.Red.alpha(0.2f); color2 = Colors.Red.alpha(0.8f); stop = new Point2D.Float(500, 2); } else if (warnlevel == Datastream.WarnLevel.MEDIUM) { color1 = Colors.Orange.alpha(0.3f); color2 = Colors.Orange.alpha(0.8f); stop = new Point2D.Float(500, 2); } else if (warnlevel == Datastream.WarnLevel.LOW) { color1 = Colors.Orange.alpha(0.2f); color2 = Colors.Orange.alpha(0.4f); stop = new Point2D.Float(500, 2); } } final LinearGradientPaint gradientPaint = new LinearGradientPaint(start, stop, new float[] { 0.0f, 1.0f }, new Color[] { color1, color2 }); final MattePainter mattePainter = new MattePainter(gradientPaint, true); p.setBackgroundPainter(mattePainter); if (isSelected) { p.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createLineBorder(UIManager.getColor("List.background"), 2), BorderFactory.createBevelBorder(BevelBorder.LOWERED))); } else { p.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createLineBorder(UIManager.getColor("List.background"), 2), BorderFactory.createEtchedBorder())); } return p; }
From source file:com.hp.alm.ali.idea.content.settings.SettingsPanel.java
private void setCaption(String caption) { preview.setBorder(BorderFactory.createCompoundBorder(BorderFactory .createCompoundBorder(new EmptyBorder(0, 10, 10, 10), BorderFactory.createTitledBorder(caption)), new EmptyBorder(10, 10, 10, 10))); }
From source file:net.sf.xmm.moviemanager.gui.DialogIMDbMultiAdd.java
JPanel createFileLocationPanel() { // Panel file location JPanel fileLocationPanel = new JPanel(); fileLocationPanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), " Movie parts "), BorderFactory.createEmptyBorder(0, 3, 3, 3))); fileLocationPanel.setLayout(new BorderLayout()); fileLocation = new JTextArea(); fileLocation.setEditable(false);/*from w w w .j a va 2 s. com*/ JScrollPane fileLocaScroll = new JScrollPane(fileLocation); fileLocationPanel.add(fileLocaScroll, BorderLayout.CENTER); fileLocation.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { //handleFileLocationPopup(e); } }); return fileLocationPanel; }