List of usage examples for javax.swing.border LineBorder LineBorder
public LineBorder(Color color)
From source file:utilities.GraphViewer.java
public void addSensor(String fichier) { // ajouter le graphe ajouterFichier(fichier);/*from w ww.j ava2 s .co m*/ // this.paneGraphe.add(graphe()); graphe.revalidate(); db.add(this.getSensorName(fichier), fichier); // ajouter un element a la list JCheckBox chckbxNewCheckBox = new JCheckBox(this.getSensorName(fichier)); this.sensors.add(chckbxNewCheckBox); this.sensors1.add(chckbxNewCheckBox); chckbxNewCheckBox.setBackground(new Color(200, 200, 255)); chckbxNewCheckBox.setBorder(new LineBorder(Color.BLACK)); chckbxNewCheckBox.setSelected(true); chckbxNewCheckBox.addActionListener(this); JLabel l = new JLabel(" "); l.setPreferredSize(new Dimension(50, 5)); this.sensorsList.add(l); this.sensorsList.add(chckbxNewCheckBox); this.sensorsList.validate(); }
From source file:net.daboross.outputtablesclient.gui.OutputInterface.java
private void createTable(String tableKey) { String displayName = application.getOutput().getNameTable().get(tableKey); if (displayName == null) { Output.logError("Warning! No known display name for table %s", tableKey); displayName = tableKey;//from w ww . j a v a 2s. c o m } JPanel tablePanel = new JPanel(new WrapLayout()); Border lineBorder = new LineBorder(new Color(0, 0, 0)); TitledBorder titleBorder = new TitledBorder(lineBorder, displayName); tableKeyToTableTitledBoarder.put(tableKey, titleBorder); Border spaceBorder = new EmptyBorder(5, 5, 5, 5); Border compoundBorder = new CompoundBorder(titleBorder, spaceBorder); tablePanel.setBorder(compoundBorder); tableKeyToTablePanel.put(tableKey, tablePanel); JToggleButton toggleButton = new JToggleButton(displayName); TableToggleListener listener = new TableToggleListener(toggleButton, tableKey); toggleButton.addItemListener(listener); listener.initialAdd(); tableKeyToTableButton.put(tableKey, toggleButton); toggleButtonPanel.removeAll(); for (JToggleButton button : tableKeyToTableButton.values()) { toggleButtonPanel.add(button, toggleButtonConstraints); } tableKeyAndKeyToValuePanel.put(tableKey, new HashMap<>()); tableKeyAndKeyToValueLabel.put(tableKey, new HashMap<>()); }
From source file:BoxAlignmentDemo.java
protected JPanel createYAlignmentExample(boolean doItRight) { JPanel pane = new JPanel(); String title;// w ww .j ava 2 s .c o m JComponent component1 = new JPanel(); Dimension size = new Dimension(100, 50); component1.setMaximumSize(size); component1.setPreferredSize(size); component1.setMinimumSize(size); TitledBorder border = new TitledBorder(new LineBorder(Color.black), "A JPanel", TitledBorder.CENTER, TitledBorder.BELOW_TOP); border.setTitleColor(Color.black); component1.setBorder(border); JComponent component2 = new JPanel(); size = new Dimension(100, 50); component2.setMaximumSize(size); component2.setPreferredSize(size); component2.setMinimumSize(size); border = new TitledBorder(new LineBorder(Color.black), "A JPanel", TitledBorder.CENTER, TitledBorder.BELOW_TOP); border.setTitleColor(Color.black); component2.setBorder(border); if (doItRight) { title = "Matched"; } else { component1.setAlignmentY(TOP_ALIGNMENT); title = "Mismatched"; } pane.setBorder(BorderFactory.createTitledBorder(title)); pane.setLayout(new BoxLayout(pane, BoxLayout.X_AXIS)); pane.add(component1); pane.add(component2); return pane; }
From source file:com.vgi.mafscaling.OpenLoop.java
private void createRunTables(JPanel dataRunPanel) { GridBagConstraints gbc_run = new GridBagConstraints(); gbc_run.anchor = GridBagConstraints.PAGE_START; gbc_run.insets = new Insets(0, 2, 0, 2); for (int i = 0; i < RunCount; ++i) { runTables[i] = new JTable(); JTable table = runTables[i]; table.getTableHeader().setReorderingAllowed(false); table.setModel(new DefaultTableModel(RunRowsCount, 3)); table.setColumnSelectionAllowed(true); table.setCellSelectionEnabled(true); table.setBorder(new LineBorder(new Color(0, 0, 0))); table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); table.getColumnModel().getColumn(0) .setHeaderValue("<html><center>Engine<br>Speed<br>(RPM)<br></center></html>"); table.getColumnModel().getColumn(1) .setHeaderValue("<html><center>MAF<br>Sensor<br>Voltage<br></center></html>"); table.getColumnModel().getColumn(2) .setHeaderValue("<html><center>AFR<br>Error<br>%<br></center></html>"); Utils.initializeTable(table, ColumnWidth); excelAdapter.addTable(table, true, false); gbc_run.gridx = i;/*w w w .j a v a 2 s . c o m*/ gbc_run.gridy = 0; dataRunPanel.add(table.getTableHeader(), gbc_run); gbc_run.gridy = 1; dataRunPanel.add(table, gbc_run); } }
From source file:com.mirth.connect.client.ui.browsers.event.EventBrowser.java
public void initComponentsManual() { this.addMouseListener(new java.awt.event.MouseAdapter() { public void mousePressed(java.awt.event.MouseEvent evt) { if (evt.isPopupTrigger()) { parent.eventPopupMenu.show(evt.getComponent(), evt.getX(), evt.getY()); }// ww w .j a v a2 s . c o m } public void mouseReleased(java.awt.event.MouseEvent evt) { if (evt.isPopupTrigger()) { parent.eventPopupMenu.show(evt.getComponent(), evt.getX(), evt.getY()); } } }); pageSizeField.setDocument(new MirthFieldConstraints(3, false, false, true)); pageNumberField.setDocument(new MirthFieldConstraints(7, false, false, true)); LineBorder lineBorder = new LineBorder(new Color(0, 0, 0)); TitledBorder titledBorder = new TitledBorder("Current Search"); titledBorder.setBorder(lineBorder); lastSearchCriteriaPane.setBorder(titledBorder); lastSearchCriteriaPane.setBackground(Color.white); lastSearchCriteria.setBackground(Color.white); startDatePicker.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent arg0) { allDayCheckBox.setEnabled(startDatePicker.getDate() != null || endDatePicker.getDate() != null); startTimePicker.setEnabled(startDatePicker.getDate() != null && !allDayCheckBox.isSelected()); } }); endDatePicker.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent arg0) { allDayCheckBox.setEnabled(startDatePicker.getDate() != null || endDatePicker.getDate() != null); endTimePicker.setEnabled(endDatePicker.getDate() != null && !allDayCheckBox.isSelected()); } }); pageNumberField.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent arg0) { if (arg0.getKeyCode() == KeyEvent.VK_ENTER && pageGoButton.isEnabled()) { jumpToPageNumber(); } } }); updateCachedUserMap(); advancedSearchPopup = new EventBrowserAdvancedFilter(parent, "Advanced Search Filter", true, userMapById); advancedSearchPopup.setVisible(false); eventSplitPane.setDividerLocation(0.8); this.addAncestorListener(new AncestorListener() { @Override public void ancestorAdded(AncestorEvent event) { } @Override public void ancestorMoved(AncestorEvent event) { } @Override public void ancestorRemoved(AncestorEvent event) { // Stop waiting for event browser requests when the event browser // is no longer being displayed parent.mirthClient.getServerConnection().abort(getAbortOperations()); // Clear the event cache when leaving the event browser. parent.eventBrowser.clearCache(); } }); }
From source file:com.net2plan.gui.utils.onlineSimulationPane.OnlineSimulationPane.java
public OnlineSimulationPane(IVisualizationCallback mainWindow) { super();/*from w w w. j a va 2 s. com*/ this.mainWindow = mainWindow; simKernel = new SimKernel(); simKernel.setGUIListener(this); File ALGORITHMS_DIRECTORY = new File( IGUIModule.CURRENT_DIR + SystemUtils.getDirectorySeparator() + "workspace"); ALGORITHMS_DIRECTORY = ALGORITHMS_DIRECTORY.isDirectory() ? ALGORITHMS_DIRECTORY : IGUIModule.CURRENT_DIR; eventGeneratorPanel = new RunnableSelector(SimKernel.getEventGeneratorLabel(), "File", simKernel.getEventGeneratorClass(), ALGORITHMS_DIRECTORY, new ParameterValueDescriptionPanel()); eventProcessorPanel = new RunnableSelector(SimKernel.getEventProcessorLabel(), "File", simKernel.getEventProcessorClass(), ALGORITHMS_DIRECTORY, new ParameterValueDescriptionPanel()); simulationConfigurationPanel = new ParameterValueDescriptionPanel(); simulationConfigurationPanel.setParameters(simKernel.getSimulationParameters()); JTabbedPane configPane = new JTabbedPane(); configPane.addTab(SimKernel.getEventGeneratorLabel(), eventGeneratorPanel); configPane.addTab(SimKernel.getEventProcessorLabel(), eventProcessorPanel); JPanel topPane = new JPanel(new MigLayout("insets 0 0 0 0", "[][grow][]", "[][grow]")); topPane.add(new JLabel("Simulation parameters"), "spanx 3, wrap"); topPane.add(simulationConfigurationPanel, "spanx 3, grow, wrap"); splitPaneConfiguration = new JSplitPane(JSplitPane.VERTICAL_SPLIT); splitPaneConfiguration.setTopComponent(topPane); splitPaneConfiguration.setBottomComponent(configPane); splitPaneConfiguration.setResizeWeight(0.5); splitPaneConfiguration.addPropertyChangeListener(new ProportionalResizeJSplitPaneListener()); splitPaneConfiguration .setBorder(BorderFactory.createTitledBorder(new LineBorder(Color.BLACK), "Simulation execution")); JPanel pan_execution = new JPanel(new MigLayout("fill, insets 0 0 0 0")); pan_execution.add(splitPaneConfiguration, "grow"); btn_updateReport = new JButton("Update"); btn_updateReport.setToolTipText("Update the simulation report"); btn_updateReport.addActionListener(this); simReport = new JPanel(); simReport.setLayout(new BorderLayout()); simReport.add(btn_updateReport, BorderLayout.NORTH); addTab("Simulation input parameters", pan_execution); simulationControlPanel = configureSimulationControlPanel(); addTab("Simulation control", simulationControlPanel); addTab("Simulation report", simReport); simReportTab = 2; simKernel.reset(); if (mainWindow.getDesign() != null) simKernel.setNetPlan(mainWindow.getDesign()); }
From source file:de.interactive_instruments.ShapeChange.UI.DefaultDialog.java
private JPanel createTab2() { final JPanel reportPanel = new JPanel(new GridLayout(3, 1)); reportGroup = new ButtonGroup(); String param = options.parameter("reportLevel"); addRadioButton(reportPanel, reportGroup, "Error", "ERROR", param); addRadioButton(reportPanel, reportGroup, "Warning", "WARNING", param); addRadioButton(reportPanel, reportGroup, "Info", "INFO", param); reportPanel.setBorder(new TitledBorder(new LineBorder(Color.black), "Report options", TitledBorder.LEFT, TitledBorder.TOP));/*from w ww . j a va 2 s . co m*/ final JPanel rulePanel = new JPanel(new GridLayout(3, 1)); ruleGroup = new ButtonGroup(); param = options.parameter(Options.TargetXmlSchemaClass, "defaultEncodingRule"); addRadioButton(rulePanel, ruleGroup, "GML 3.2", "iso19136_2007", param); addRadioButton(rulePanel, ruleGroup, "GML 3.3", "gml33", param); addRadioButton(rulePanel, ruleGroup, "ISO/TS 19139", "iso19139_2007", param); addRadioButton(rulePanel, ruleGroup, "GML 3.2 (ShapeChange extensions)", "iso19136_2007_ShapeChange_1.0_extensions", param); addRadioButton(rulePanel, ruleGroup, "GML 3.3 (INSPIRE extensions)", "iso19136_2007_INSPIRE_Extensions", param); rulePanel.setBorder(new TitledBorder(new LineBorder(Color.black), "Default encoding rule", TitledBorder.LEFT, TitledBorder.TOP)); final JPanel otherPanel = new JPanel(new GridLayout(2, 1)); docCB = new JCheckBox("Include documentation", true); boolean b = true; String s = options.parameter(Options.TargetXmlSchemaClass, "includeDocumentation"); if (s != null && s.equals("false")) b = false; docCB.setSelected(b); otherPanel.add(docCB); visCB = new JCheckBox("Ignore visibility"); b = true; s = options.parameter("publicOnly"); if (s != null && s.equals("false")) b = false; visCB.setSelected(!b); otherPanel.add(visCB); otherPanel.setBorder(new TitledBorder(new LineBorder(Color.black), "Other options", TitledBorder.LEFT, TitledBorder.TOP)); Box innerBox = Box.createHorizontalBox(); innerBox.add(reportPanel); innerBox.add(otherPanel); Box mainBox = Box.createVerticalBox(); mainBox.add(innerBox); mainBox.add(rulePanel); JPanel panel = new JPanel(new BorderLayout()); panel.add(mainBox, BorderLayout.CENTER); return panel; }
From source file:net.daboross.outputtablesclient.gui.OutputInterface.java
@Override public void onUpdate(final RobotTable table, final String key, final String value, final UpdateAction action) { if (!application.getOutput().getNameTable().contains(table.getName())) { return;/*from w w w . j a v a2 s . c om*/ } if (action == UpdateAction.NEW) { // if (key.equalsIgnoreCase(":RangeGUI")) { // Output.oLog("Range: %s", value); // try { // application.getCustomInterface().setTo(Double.parseDouble(value)); // } catch (NumberFormatException ex) { // Output.oLog("Invalid range '%s'", value); // } // } ensureTableExists(table.getName()); JPanel panel = new JPanel(new GridBagLayout()); panel.setBorder(new LineBorder(Color.BLACK)); tableKeyAndKeyToValuePanel.get(table.getName()).put(key, panel); JLabel keyLabel = new JLabel(key); keyLabel.setBorder(new EmptyBorder(5, 5, 5, 5)); panel.add(keyLabel, new GBC().fill(GridBagConstraints.VERTICAL).gridy(0)); JSeparator separator = new JSeparator(JSeparator.VERTICAL); separator.setPreferredSize(new Dimension(2, 20)); panel.add(separator, new GBC().fill(GridBagConstraints.VERTICAL).gridy(0)); JLabel valueLabel = new JLabel(value); valueLabel.setBorder(new EmptyBorder(5, 5, 5, 5)); panel.add(valueLabel, new GBC().fill(GridBagConstraints.VERTICAL).gridy(0)); tableKeyAndKeyToValueLabel.get(table.getName()).put(key, valueLabel); JPanel parentPanel = tableKeyToTablePanel.get(table.getName()); parentPanel.add(panel); parentPanel.revalidate(); } else if (action == UpdateAction.UPDATE) { // if (key.equalsIgnoreCase(":RangeGUI")) { // Output.oLog("Range: %s", value); // try { // application.getCustomInterface().setTo(Double.parseDouble(value)); // } catch (NumberFormatException ex) { // Output.oLog("Invalid range '%s'", value); // } // } ensureTableExists(table.getName()); JLabel valueLabel = tableKeyAndKeyToValueLabel.get(table.getName()).get(key); valueLabel.setText(value); } else if (action == UpdateAction.DELETE) { if (tableKeyToTablePanel.get(table.getName()) == null) { return; } JPanel parentPanel = tableKeyToTablePanel.get(table.getName()); JPanel valuePanel = tableKeyAndKeyToValuePanel.get(table.getName()).remove(key); parentPanel.remove(valuePanel); parentPanel.revalidate(); } }
From source file:com.net2plan.gui.tools.GUINetworkDesign.java
@Override public void configure(JPanel contentPane) { this.currentNetPlan = new NetPlan(); BidiMap<NetworkLayer, Integer> mapLayer2VisualizationOrder = new DualHashBidiMap<>(); Map<NetworkLayer, Boolean> layerVisibilityMap = new HashMap<>(); for (NetworkLayer layer : currentNetPlan.getNetworkLayers()) { mapLayer2VisualizationOrder.put(layer, mapLayer2VisualizationOrder.size()); layerVisibilityMap.put(layer, true); }//from w w w . j av a2s . c om this.vs = new VisualizationState(currentNetPlan, mapLayer2VisualizationOrder, layerVisibilityMap, MAXSIZEUNDOLISTPICK); topologyPanel = new TopologyPanel(this, JUNGCanvas.class); JPanel leftPane = new JPanel(new BorderLayout()); JPanel logSection = configureLeftBottomPanel(); if (logSection == null) { leftPane.add(topologyPanel, BorderLayout.CENTER); } else { JSplitPane splitPaneTopology = new JSplitPane(JSplitPane.VERTICAL_SPLIT); splitPaneTopology.setTopComponent(topologyPanel); splitPaneTopology.setBottomComponent(logSection); splitPaneTopology.addPropertyChangeListener(new ProportionalResizeJSplitPaneListener()); splitPaneTopology.setBorder(new LineBorder(contentPane.getBackground())); splitPaneTopology.setOneTouchExpandable(true); splitPaneTopology.setDividerSize(7); leftPane.add(splitPaneTopology, BorderLayout.CENTER); } contentPane.add(leftPane, "grow"); viewEditTopTables = new ViewEditTopologyTablesPane(GUINetworkDesign.this, new BorderLayout()); reportPane = new ViewReportPane(GUINetworkDesign.this, JSplitPane.VERTICAL_SPLIT); setCurrentNetPlanDoNotUpdateVisualization(currentNetPlan); Pair<BidiMap<NetworkLayer, Integer>, Map<NetworkLayer, Boolean>> res = VisualizationState .generateCanvasDefaultVisualizationLayerInfo(getDesign()); vs.setCanvasLayerVisibilityAndOrder(getDesign(), res.getFirst(), res.getSecond()); /* Initialize the undo/redo manager, and set its initial design */ this.undoRedoManager = new UndoRedoManager(this, MAXSIZEUNDOLISTCHANGES); this.undoRedoManager.addNetPlanChange(); onlineSimulationPane = new OnlineSimulationPane(this); executionPane = new OfflineExecutionPanel(this); whatIfAnalysisPane = new WhatIfAnalysisPane(this); // Closing windows WindowUtils.clearFloatingWindows(); final JTabbedPane tabPane = new JTabbedPane(); tabPane.add(WindowController.WindowToTab.getTabName(WindowController.WindowToTab.network), viewEditTopTables); tabPane.add(WindowController.WindowToTab.getTabName(WindowController.WindowToTab.offline), executionPane); tabPane.add(WindowController.WindowToTab.getTabName(WindowController.WindowToTab.online), onlineSimulationPane); tabPane.add(WindowController.WindowToTab.getTabName(WindowController.WindowToTab.whatif), whatIfAnalysisPane); tabPane.add(WindowController.WindowToTab.getTabName(WindowController.WindowToTab.report), reportPane); // Installing customized mouse listener MouseListener[] ml = tabPane.getListeners(MouseListener.class); for (int i = 0; i < ml.length; i++) { tabPane.removeMouseListener(ml[i]); } // Left click works as usual, right click brings up a pop-up menu. tabPane.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { JTabbedPane tabPane = (JTabbedPane) e.getSource(); int tabIndex = tabPane.getUI().tabForCoordinate(tabPane, e.getX(), e.getY()); if (tabIndex >= 0 && tabPane.isEnabledAt(tabIndex)) { if (tabIndex == tabPane.getSelectedIndex()) { if (tabPane.isRequestFocusEnabled()) { tabPane.requestFocus(); tabPane.repaint(tabPane.getUI().getTabBounds(tabPane, tabIndex)); } } else { tabPane.setSelectedIndex(tabIndex); } if (!tabPane.isEnabled() || SwingUtilities.isRightMouseButton(e)) { final JPopupMenu popupMenu = new JPopupMenu(); final JMenuItem popWindow = new JMenuItem("Pop window out"); popWindow.addActionListener(e1 -> { final int selectedIndex = tabPane.getSelectedIndex(); final String tabName = tabPane.getTitleAt(selectedIndex); final JComponent selectedComponent = (JComponent) tabPane.getSelectedComponent(); // Pops up the selected tab. final WindowController.WindowToTab windowToTab = WindowController.WindowToTab .parseString(tabName); if (windowToTab != null) { switch (windowToTab) { case offline: WindowController.buildOfflineWindow(selectedComponent); WindowController.showOfflineWindow(true); break; case online: WindowController.buildOnlineWindow(selectedComponent); WindowController.showOnlineWindow(true); break; case whatif: WindowController.buildWhatifWindow(selectedComponent); WindowController.showWhatifWindow(true); break; case report: WindowController.buildReportWindow(selectedComponent); WindowController.showReportWindow(true); break; default: return; } } tabPane.setSelectedIndex(0); }); // Disabling the pop up button for the network state tab. if (WindowController.WindowToTab.parseString(tabPane .getTitleAt(tabPane.getSelectedIndex())) == WindowController.WindowToTab.network) { popWindow.setEnabled(false); } popupMenu.add(popWindow); popupMenu.show(e.getComponent(), e.getX(), e.getY()); } } } }); // Building windows WindowController.buildTableControlWindow(tabPane); WindowController.showTablesWindow(false); addAllKeyCombinationActions(); updateVisualizationAfterNewTopology(); }
From source file:com.vgi.mafscaling.ClosedLoop.java
private void createLogDataTable(JScrollPane dataScrollPane) { JPanel dataRunPanel = new JPanel(); dataScrollPane.setViewportView(dataRunPanel); GridBagLayout gbl_dataRunPanel = new GridBagLayout(); gbl_dataRunPanel.columnWidths = new int[] { 0 }; gbl_dataRunPanel.rowHeights = new int[] { 0 }; gbl_dataRunPanel.columnWeights = new double[] { 0.0 }; gbl_dataRunPanel.rowWeights = new double[] { 0.0 }; dataRunPanel.setLayout(gbl_dataRunPanel); logDataTable = new JTable(); logDataTable.getTableHeader().setReorderingAllowed(false); logDataTable.setModel(new DefaultTableModel(LogDataRowCount, ColumnCount)); logDataTable.setColumnSelectionAllowed(true); logDataTable.setCellSelectionEnabled(true); logDataTable.setBorder(new LineBorder(new Color(0, 0, 0))); logDataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); logDataTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); logDataTable.getColumnModel().getColumn(0).setHeaderValue("Time"); logDataTable.getColumnModel().getColumn(1).setHeaderValue("Load"); logDataTable.getColumnModel().getColumn(2).setHeaderValue("RPM"); logDataTable.getColumnModel().getColumn(3).setHeaderValue("MafV"); logDataTable.getColumnModel().getColumn(4).setHeaderValue("AFR"); logDataTable.getColumnModel().getColumn(5).setHeaderValue("STFT"); logDataTable.getColumnModel().getColumn(6).setHeaderValue("LTFT"); logDataTable.getColumnModel().getColumn(7).setHeaderValue("dV/dt"); logDataTable.getColumnModel().getColumn(8).setHeaderValue("IAT"); Utils.initializeTable(logDataTable, ColumnWidth); GridBagConstraints gbc = new GridBagConstraints(); gbc.insets = new Insets(0, 0, 0, 0); gbc.anchor = GridBagConstraints.PAGE_START; gbc.gridx = 0;/* w w w .ja v a2 s .co m*/ gbc.gridy = 0; dataRunPanel.add(logDataTable.getTableHeader(), gbc); gbc.gridy = 1; dataRunPanel.add(logDataTable, gbc); excelAdapter.addTable(logDataTable, true, false); }