List of usage examples for javax.swing BorderFactory createLineBorder
public static Border createLineBorder(Color color)
From source file:ome.formats.importer.gui.GuiCommonElements.java
/** * Add a TextArea that has scrolling functionality * // w ww. j ava2 s . c o m * @param container - parent container * @param name - name of text area * @param text - text to put in text area * @param mnemonic - mnemonic key * @param placement - TableLayout placement in parent container * @param debug - turn on/off red debug borders * @return JTextArea */ public static JTextArea addScrollingTextArea(Container container, String name, String text, int mnemonic, String placement, boolean debug) { JPanel panel = new JPanel(); panel.setOpaque(false); double size[][] = { { TableLayout.FILL }, { 20, TableLayout.FILL } }; TableLayout layout = new TableLayout(size); panel.setLayout(layout); JTextArea textArea = new JTextArea(); textArea.setLineWrap(true); textArea.setOpaque(true); JScrollPane areaScrollPane = new JScrollPane(textArea); areaScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); if (debug == true) panel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.red), panel.getBorder())); if (!name.equals("")) { JLabel label = new JLabel(name); label.setOpaque(false); label.setDisplayedMnemonic(mnemonic); panel.add(label, "0, 0, l, c"); panel.add(areaScrollPane, "0, 1, f, f"); } else { panel.add(areaScrollPane, "0, 0, 0, 1"); } container.add(panel, placement); return textArea; }
From source file:edu.ku.brc.specify.tools.l10nios.StrLocalizerAppForiOS.java
/** * @param langCode the language code - "es", "en" ,etc * /*w w w .ja va2 s .c om*/ * Assumes srcLocaleFiles has already been setup. */ // protected void setupDestFiles(final String langCode, final String destPath) // { // destFiles.clear(); // for (StrLocaleFile f : srcFiles) // { // String newPath; // if (destPath != null) // { // File duh = new File(f.getPath()); // String newName = duh.getName().replace("_" + srcLangCode + ".", "_" + langCode + "."); // newPath = destPath + File.separator + newName; // } // else // { // String path = f.getPath(); // newPath = path.replace("_" + srcLangCode + ".", "_" + langCode + "."); // newPath = newPath.replace(File.separator + srcLangCode + File.separator, File.separator + langCode + File.separator); // } // destFiles.add(new StrLocaleFile(newPath, f.getPath(), true)); // } // } private JTextArea setTAReadOnly(final JTextArea textArea) { textArea.setEditable(false); textArea.setLineWrap(true); if (!UIHelper.isMacOS()) { textArea.setBorder(BorderFactory.createLineBorder(Color.BLACK)); //textArea.setBackground(new Color(245,245,245)); } return textArea; }
From source file:com.eviware.soapui.impl.wsdl.panels.mock.WsdlMockServiceDesktopPanel.java
protected JComponent buildLog() { JPanel panel = new JPanel(new BorderLayout()); JXToolBar builder = UISupport.createToolbar(); enableLogCheckBox = new JCheckBox(" ", true); enableLogCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { testLogList.setEnabled(enableLogCheckBox.isSelected()); if (mockRunner != null) mockRunner.setLogEnabled(enableLogCheckBox.isSelected()); // border needs to be repainted.. logScrollPane.repaint();/*from w ww . j a v a 2 s . com*/ } }); enableLogCheckBox.setOpaque(false); builder.addFixed(enableLogCheckBox); builder.addRelatedGap(); builder.addFixed(new JLabel("Enable")); builder.addRelatedGap(); addLogActions(builder); builder.addGlue(); builder.setBorder(BorderFactory.createEmptyBorder(2, 3, 3, 3)); panel.add(builder, BorderLayout.NORTH); logListModel = new LogListModel(); testLogList = new JList(logListModel); testLogList.setCellRenderer(new LogCellRenderer()); // testLogList.setPrototypeCellValue( "Testing 123" ); // testLogList.setFixedCellWidth( -1 ); testLogList.addMouseListener(new LogListMouseListener()); testLogList.setBorder(BorderFactory.createLineBorder(Color.GRAY)); logScrollPane = new JScrollPane(testLogList); panel.add(logScrollPane, BorderLayout.CENTER); return panel; }
From source file:de.codesourcery.eve.skills.ui.components.AbstractComponent.java
protected Border lineBorder(Color c) { return BorderFactory.createLineBorder(c); }
From source file:com.t3.client.ui.T3Frame.java
public T3Frame(JMenuBar menuBar) { // Set up the frame super(AppConstants.APP_NAME); this.menuBar = menuBar; setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); addWindowListener(this); setSize(WINDOW_WIDTH, WINDOW_HEIGHT); SwingUtil.centerOnScreen(this); setFocusTraversalPolicy(new T3FocusTraversalPolicy()); try {//from ww w .j av a 2s . c o m setIconImage(ImageUtil.getImage(MINILOGO_IMAGE)); } catch (IOException ioe) { String msg = I18N.getText("msg.error.loadingIconImage"); log.error(msg, ioe); System.err.println(msg); } // Notify duration initializeNotifyDuration(); // Components glassPane = new GlassPane(); assetPanel = createAssetPanel(); connectionPanel = createConnectionPanel(); toolbox = new Toolbox(); initiativePanel = createInitiativePanel(); zoneRendererList = new CopyOnWriteArrayList<ZoneRenderer>(); pointerOverlay = new PointerOverlay(); colorPicker = new ColorPicker(this); textureChooserPanel = new TextureChooserPanel(colorPicker.getPaintChooser(), assetPanel.getModel(), "imageExplorerTextureChooser"); colorPicker.getPaintChooser().addPaintChooser(textureChooserPanel); String credits = ""; String version = ""; Image logo = null; try { credits = new String(FileUtil.loadResource(CREDITS_HTML), "UTF-8"); // 2nd param of type Charset is Java6+ version = TabletopTool.getVersion(); credits = credits.replace("%VERSION%", version); logo = ImageUtil.getImage(T3_LOGO_IMAGE); } catch (Exception ioe) { log.error(I18N.getText("msg.error.credits"), ioe); ioe.printStackTrace(); } aboutDialog = new AboutDialog(this, logo, credits); aboutDialog.setSize(354, 400); statusPanel = new StatusPanel(); statusPanel.addPanel(getCoordinateStatusBar()); statusPanel.addPanel(getZoomStatusBar()); statusPanel.addPanel(MemoryStatusBar.getInstance()); // statusPanel.addPanel(progressBar); statusPanel.addPanel(connectionStatusPanel); statusPanel.addPanel(activityMonitor); statusPanel.addPanel(new SpacerStatusBar(25)); zoneRendererPanel = new JPanel(new PositionalLayout(5)); zoneRendererPanel.setBackground(Color.black); // zoneRendererPanel.add(zoneMiniMapPanel, PositionalLayout.Position.SE); // zoneRendererPanel.add(getChatTypingLabel(), PositionalLayout.Position.NW); zoneRendererPanel.add(getChatTypingPanel(), PositionalLayout.Position.NW); zoneRendererPanel.add(getChatActionLabel(), PositionalLayout.Position.SW); commandPanel = new CommandPanel(); TabletopTool.getMessageList().addObserver(commandPanel); rendererBorderPanel = new JPanel(new GridLayout()); rendererBorderPanel.setBorder(BorderFactory.createLineBorder(Color.darkGray)); rendererBorderPanel.add(zoneRendererPanel); // Put it all together setJMenuBar(menuBar); add(BorderLayout.NORTH, new ToolbarPanel(toolbox)); add(BorderLayout.SOUTH, statusPanel); JLayeredPane glassPaneComposite = new JLayeredPane(); glassPaneComposite.setLayout(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); constraints.gridx = 1; constraints.gridy = 1; constraints.fill = GridBagConstraints.BOTH; constraints.weightx = 1; constraints.weighty = 1; glassPaneComposite.add(glassPane, constraints); glassPaneComposite.add(dragImageGlassPane, constraints); setGlassPane(glassPane); // setGlassPane(glassPaneComposite); glassPaneComposite.setVisible(true); if (!TabletopTool.MAC_OS_X) removeWindowsF10(); else registerForMacOSXEvents(); TabletopTool.getEventDispatcher().addListener(this, TabletopTool.ZoneEvent.Activated); restorePreferences(); updateKeyStrokes(); // This will cause the frame to be set to visible (BAD jide, BAD! No cookie for you!) configureDocking(); new WindowPreferences(AppConstants.APP_NAME, "mainFrame", this); chatTyperObserver = new ChatTyperObserver(); chatTyperTimers = new ChatNotificationTimers(); chatTyperTimers.addObserver(chatTyperObserver); chatTimer = getChatTimer(); setChatTypingLabelColor(AppPreferences.getChatNotificationColor()); }
From source file:ome.formats.importer.gui.GuiCommonElements.java
/** * Add a button//from w w w .j a v a 2 s . com * * @param container - parent container * @param label - button label * @param mnemonic - button mnemonic * @param tooltip - button tool tip * @param placement - TableLayout placement in parent container * @param debug - turn on/off red debug borders * @return JButton */ public static JButton addButton(Container container, String label, int mnemonic, String tooltip, String placement, boolean debug) { JButton button = new JButton(label); button.setMnemonic(mnemonic); button.setToolTipText(tooltip); button.setOpaque(!getIsMac()); container.add(button, placement); if (debug == true) button.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.red), button.getBorder())); return button; }
From source file:com.haulmont.cuba.desktop.App.java
protected JComponent createBottomPane() { JPanel panel = new JPanel(new BorderLayout()); panel.setBorder(BorderFactory.createLineBorder(Color.gray)); panel.setPreferredSize(new Dimension(0, 20)); ServerSelector serverSelector = AppBeans.get(ServerSelector.NAME); String url = serverSelector.getUrl(serverSelector.initContext()); if (url == null) url = "?"; final JLabel connectionStateLab = new JLabel( messages.formatMainMessage("statusBar.connected", getUserFriendlyConnectionUrl(url))); panel.add(connectionStateLab, BorderLayout.WEST); JPanel rightPanel = new JPanel(); BoxLayout rightLayout = new BoxLayout(rightPanel, BoxLayout.LINE_AXIS); rightPanel.setLayout(rightLayout);//from w w w . j a v a2 s. c o m UserSession session = connection.getSession(); JLabel userInfoLabel = new JLabel(); String userInfo = messages.formatMainMessage("statusBar.user", session.getUser().getName(), session.getUser().getLogin()); userInfoLabel.setText(userInfo); rightPanel.add(userInfoLabel); JLabel timeZoneLabel = null; if (session.getTimeZone() != null) { timeZoneLabel = new JLabel(); String timeZone = messages.formatMainMessage("statusBar.timeZone", AppBeans.get(TimeZones.class).getDisplayNameShort(session.getTimeZone())); timeZoneLabel.setText(timeZone); rightPanel.add(Box.createRigidArea(new Dimension(5, 0))); rightPanel.add(timeZoneLabel); } panel.add(rightPanel, BorderLayout.EAST); if (isTestMode()) { panel.setName("bottomPane"); userInfoLabel.setName("userInfoLabel"); if (timeZoneLabel != null) timeZoneLabel.setName("timeZoneLabel"); connectionStateLab.setName("connectionStateLab"); } return panel; }
From source file:com.chart.SwingChart.java
/** * //from ww w . j a va 2 s . com * @param name Chart name * @param parent Skeleton parent * @param axes Configuration of axes * @param abcissaName Abcissa name */ public SwingChart(String name, final Skeleton parent, List<AxisChart> axes, String abcissaName) { this.skeleton = parent; this.axes = axes; this.name = name; this.abcissaFormat = NumberFormat.getInstance(Locale.getDefault()); this.ordinateFormat = NumberFormat.getInstance(Locale.getDefault()); plot = new XYPlot(); plot.setBackgroundPaint(scene2awtColor(javafx.scene.paint.Color.web(strChartBackgroundColor))); plot.setDomainGridlinePaint(scene2awtColor(javafx.scene.paint.Color.web(strGridlineColor))); plot.setRangeGridlinePaint(scene2awtColor(javafx.scene.paint.Color.web(strGridlineColor))); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); abcissaAxis = new NumberAxis(abcissaName); ((NumberAxis) abcissaAxis).setAutoRangeIncludesZero(false); abcissaAxis.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 12)); abcissaAxis.setLabelFont(new Font("SansSerif", Font.PLAIN, 12)); abcissaAxis.setLabelPaint(scene2awtColor(javafx.scene.paint.Color.web(strTickColor))); abcissaAxis.setTickLabelPaint(scene2awtColor(javafx.scene.paint.Color.web(strTickColor))); abcissaAxis.setAutoRange(true); abcissaAxis.setLowerMargin(0.0); abcissaAxis.setUpperMargin(0.0); abcissaAxis.setTickLabelsVisible(true); abcissaAxis.setLabelFont(abcissaAxis.getLabelFont().deriveFont(fontSize)); abcissaAxis.setTickLabelFont(abcissaAxis.getLabelFont().deriveFont(fontSize)); plot.setDomainAxis(abcissaAxis); for (int i = 0; i < axes.size(); i++) { AxisChart categoria = axes.get(i); addAxis(categoria.getName()); for (int j = 0; j < categoria.configSerieList.size(); j++) { SimpleSeriesConfiguration cs = categoria.configSerieList.get(j); addSeries(categoria.getName(), cs); } } chart = new JFreeChart("", new Font("SansSerif", Font.BOLD, 16), plot, false); chart.setBackgroundPaint(scene2awtColor(javafx.scene.paint.Color.web(strBackgroundColor))); chartPanel = new ChartPanel(chart); chartPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4), BorderFactory.createLineBorder(scene2awtColor(javafx.scene.paint.Color.web(strBackgroundColor))))); chartPanel.getInputMap().put(KeyStroke.getKeyStroke("ESCAPE"), "escape"); chartPanel.getActionMap().put("escape", new AbstractAction() { @Override public void actionPerformed(java.awt.event.ActionEvent e) { for (int i = 0; i < plot.getDatasetCount(); i++) { XYDataset test = plot.getDataset(i); XYItemRenderer r = plot.getRenderer(i); r.removeAnnotations(); } } }); chartPanel.addChartMouseListener(cml = new ChartMouseListener() { @Override public void chartMouseClicked(ChartMouseEvent event) { } @Override public void chartMouseMoved(ChartMouseEvent event) { try { XYItemEntity xyitem = (XYItemEntity) event.getEntity(); // get clicked entity XYDataset dataset = (XYDataset) xyitem.getDataset(); // get data set double x = dataset.getXValue(xyitem.getSeriesIndex(), xyitem.getItem()); double y = dataset.getYValue(xyitem.getSeriesIndex(), xyitem.getItem()); final XYPlot plot = chart.getXYPlot(); for (int i = 0; i < plot.getDatasetCount(); i++) { XYDataset test = plot.getDataset(i); XYItemRenderer r = plot.getRenderer(i); r.removeAnnotations(); if (test == dataset) { NumberAxis ejeOrdenada = AxesList.get(i); double y_max = ejeOrdenada.getUpperBound(); double y_min = ejeOrdenada.getLowerBound(); double x_max = abcissaAxis.getUpperBound(); double x_min = abcissaAxis.getLowerBound(); double angulo; if (y > (y_max + y_min) / 2 && x > (x_max + x_min) / 2) { angulo = 3.0 * Math.PI / 4.0; } else if (y > (y_max + y_min) / 2 && x < (x_max + x_min) / 2) { angulo = 1.0 * Math.PI / 4.0; } else if (y < (y_max + y_min) / 2 && x < (x_max + x_min) / 2) { angulo = 7.0 * Math.PI / 4.0; } else { angulo = 5.0 * Math.PI / 4.0; } CircleDrawer cd = new CircleDrawer((Color) r.getSeriesPaint(xyitem.getSeriesIndex()), new BasicStroke(2.0f), null); //XYAnnotation bestBid = new XYDrawableAnnotation(dataset.getXValue(xyitem.getSeriesIndex(), xyitem.getItem()), dataset.getYValue(xyitem.getSeriesIndex(), xyitem.getItem()), 11, 11, cd); String txt = "X:" + abcissaFormat.format(x) + ", Y:" + ordinateFormat.format(y); XYPointerAnnotation anotacion = new XYPointerAnnotation(txt, dataset.getXValue(xyitem.getSeriesIndex(), xyitem.getItem()), dataset.getYValue(xyitem.getSeriesIndex(), xyitem.getItem()), angulo); anotacion.setTipRadius(10.0); anotacion.setBaseRadius(35.0); anotacion.setFont(new Font("SansSerif", Font.PLAIN, 10)); if (Long.parseLong((strChartBackgroundColor.replace("#", "")), 16) > 0xffffff / 2) { anotacion.setPaint(Color.black); anotacion.setArrowPaint(Color.black); } else { anotacion.setPaint(Color.white); anotacion.setArrowPaint(Color.white); } //bestBid.setPaint((Color) r.getSeriesPaint(xyitem.getSeriesIndex())); r.addAnnotation(anotacion); } } //LabelValorVariable.setSize(LabelValorVariable.getPreferredSize()); } catch (NullPointerException | ClassCastException ex) { } } }); chartPanel.setPopupMenu(null); chartPanel.setBackground(scene2awtColor(javafx.scene.paint.Color.web(strBackgroundColor))); SwingNode sn = new SwingNode(); sn.setContent(chartPanel); chartFrame = new VBox(); chartFrame.getChildren().addAll(sn, legendFrame); VBox.setVgrow(sn, Priority.ALWAYS); VBox.setVgrow(legendFrame, Priority.NEVER); chartFrame.getStylesheets().addAll(SwingChart.class.getResource("overlay-chart.css").toExternalForm()); legendFrame.setStyle("marco: " + strBackgroundColor + ";-fx-background-color: marco;"); MenuItem mi; mi = new MenuItem("Print"); mi.setOnAction((ActionEvent t) -> { print(chartFrame); }); contextMenuList.add(mi); sn.setOnMouseClicked((MouseEvent t) -> { if (menu != null) { menu.hide(); } if (t.getClickCount() == 2) { backgroundEdition(); } }); mi = new MenuItem("Copy to clipboard"); mi.setOnAction((ActionEvent t) -> { copyClipboard(chartFrame); }); contextMenuList.add(mi); mi = new MenuItem("Export values"); mi.setOnAction((ActionEvent t) -> { FileChooser fileChooser = new FileChooser(); fileChooser.setTitle("Export to file"); fileChooser.getExtensionFilters() .addAll(new FileChooser.ExtensionFilter("Comma Separated Values", "*.csv")); Window w = null; try { w = parent.getScene().getWindow(); } catch (NullPointerException e) { } File file = fileChooser.showSaveDialog(w); if (file != null) { export(file); } }); contextMenuList.add(mi); chartFrame.setOnContextMenuRequested((ContextMenuEvent t) -> { if (menu != null) { menu.hide(); } menu = new ContextMenu(); menu.getItems().addAll(contextMenuList); menu.show(chartFrame, t.getScreenX(), t.getScreenY()); }); }
From source file:de.codesourcery.eve.skills.ui.components.impl.planning.CreateProductionTemplateComponent.java
@Override protected JPanel createPanel() { tree.setRootVisible(true);/*from w w w . j a va 2 s. co m*/ tree.setCellRenderer(renderer); tree.setModel(this.treeBuilder.getTreeModel()); final PopupMenuBuilder menuBuilder = new PopupMenuBuilder().addItem("Produce", new CreateSubPlanAction()) .addItem("Buy on market", new DeleteSubPlanAction()) .addItem("Buy on market", new DeleteInventionJobAction()) .addItem("Invent from T1 blueprint", new CreateInventionJobAction()); menuBuilder.attach(tree); tree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent e) { final TreePath selectedPath = e.getPath(); if (selectedPath == null || selectedPath.getPathCount() == 0) { selectedNodeChanged(null); } else { selectedNodeChanged((ITreeNode) selectedPath.getLastPathComponent()); } } }); final JScrollPane treePane = new JScrollPane(tree); // add editor panel editorPanel.setLayout(new GridBagLayout()); editorPanel.setBorder(BorderFactory.createLineBorder(Color.black)); // cost statement panel final JPanel costPanel = costStatement.getPanel(); final JPanel combinedPanel = new JPanel(); combinedPanel.setLayout(new GridBagLayout()); combinedPanel.add(costPanel, constraints(0, 0).resizeBoth().useRemainingWidth().end()); combinedPanel.add(editorPanel, constraints(0, 1).resizeBoth().useRemainingSpace().end()); final JPanel result = new JPanel(); result.setLayout(new GridBagLayout()); final JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, treePane, combinedPanel); result.add(splitPane, constraints().resizeBoth().end()); costStatement.refresh(); return result; }
From source file:org.nuxeo.launcher.gui.NuxeoFrame.java
public void debug(JComponent parent) { for (Component comp : parent.getComponents()) { if (comp instanceof JComponent) { ((JComponent) comp).setBorder(BorderFactory.createCompoundBorder( BorderFactory.createLineBorder(Color.red), ((JComponent) comp).getBorder())); log.info(comp.getClass() + " size: " + ((JComponent) comp).getSize()); }/* w w w .j a va 2 s . c o m*/ } }