List of usage examples for javax.swing BorderFactory createEmptyBorder
public static Border createEmptyBorder()
From source file:jhplot.gui.GHPanel.java
/** * Create a panel with graphics. By default, all margins have size of 10 * pixels. Background color is white. Initialization of JHPLot classes are * done here./* w ww .j a v a 2 s.c om*/ * * @param Width * in pixels * @param Height * in pixels */ public GHPanel(int Width, int Height) { System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog"); CanvasPanel = new JPanel(); // build export file tipes // list = new List<ExportFileType>(); // List<ExportFileType> list = ExportFileType.getExportFileTypes(); // addAllExportFileTypes(); this.Width = Width; this.Height = Height; // what if the screen size is smaller? Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int Sheight = screenSize.height; int Swidth = screenSize.width; if (Swidth < this.Width || Sheight < this.Height) { this.Width = (int) (0.5 * Swidth); this.Height = (int) (0.5 * Sheight); } CanvasPanel.addComponentListener(this); CanvasPanel.setPreferredSize(new Dimension(Width, Height)); CanvasPanel.setMinimumSize(new Dimension(20, 20)); leftSize = (int) (Width * 0.025); rightSize = (int) (Width * 0.025); bottomSize = (int) (Height * 0.025); topSize = (int) (Height * 0.025); backMargin = Color.white; mainPanel = new JPanel(); topPanel = new GHMargin(this, "Top"); // left panel topPanel.setGBackground(backMargin); topPanel.setGRecBackground(backMargin); leftPanel = new GHMargin(this, "Left"); // left panel leftPanel.setGBackground(backMargin); leftPanel.setGRecBackground(backMargin); rightPanel = new GHMargin(this, "Right"); // right panel rightPanel.setGBackground(backMargin); rightPanel.setGRecBackground(backMargin); bottomPanel = new GHMargin(this, "Bottom"); // buttom panel bottomPanel.setGBackground(backMargin); rightPanel.setGRecBackground(backMargin); leftPanel.setSizeMargin(leftSize, Height); rightPanel.setSizeMargin(rightSize, Height); bottomPanel.setSizeMargin(Width, bottomSize); topPanel.setSizeMargin(Width, topSize); // invert to GridLayout(); Gaps are zero mainPanel.setBackground(Color.white); mainPanel.setBorder(BorderFactory.createEmptyBorder()); CanvasPanel.setLayout(new BorderLayout()); CanvasPanel.add(mainPanel, BorderLayout.CENTER); CanvasPanel.add(leftPanel, BorderLayout.WEST); CanvasPanel.add(rightPanel, BorderLayout.EAST); CanvasPanel.add(bottomPanel, BorderLayout.SOUTH); CanvasPanel.add(topPanel, BorderLayout.NORTH); // no boarder CanvasPanel.setBorder(BorderFactory.createEmptyBorder()); // initialisation JHPlot.init(); }
From source file:com.mirth.connect.client.ui.editors.transformer.TransformerPane.java
/** * CONSTRUCTOR/*from w w w . j a v a 2 s . com*/ */ public TransformerPane() { prevSelRow = -1; modified = false; new DropTarget(this, this); initComponents(); setBorder(BorderFactory.createEmptyBorder()); }
From source file:me.paddingdun.gen.code.gui.view.dbtable.TableView.java
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor./*from w ww . jav a 2 s .co m*/ */ // <editor-fold defaultstate="collapsed" desc="Generated // Code">//GEN-BEGIN:initComponents private void initComponents() { setIconifiable(true); setMaximizable(true); setResizable(true); setTitle("?/"); fileChooser = new javax.swing.JFileChooser(); p = new javax.swing.JSplitPane(); p0t = new javax.swing.JPanel(); pt = new javax.swing.JSplitPane(); ptt = new javax.swing.JScrollPane(); ptb = new javax.swing.JScrollPane(); ptba = new javax.swing.JPanel(); pb = new javax.swing.JSplitPane(); p0b = new javax.swing.JPanel(); pbt = new javax.swing.JScrollPane(); pbb = new javax.swing.JScrollPane(); pbba = new javax.swing.JPanel(); p.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT); pt.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT); pb.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT); p.setTopComponent(p0t); p.setBottomComponent(p0b); p0t.setLayout(new BorderLayout()); p0t.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "?", TitledBorder.LEFT, TitledBorder.DEFAULT_POSITION, null, Color.BLACK)); p0t.add(pt, BorderLayout.CENTER); p0t.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { p.setDividerLocation(p.getHeight() - 40); EventQueue.invokeLater(new Runnable() { @Override public void run() { pt.setDividerLocation(0.38); EventQueue.invokeLater(new Runnable() { @Override public void run() { pb.setDividerLocation(1.0d); } }); } }); } }); p0b.setLayout(new BorderLayout()); p0b.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "", TitledBorder.LEFT, TitledBorder.DEFAULT_POSITION, null, Color.BLACK)); p0b.add(pb, BorderLayout.CENTER); p0b.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { p.setDividerLocation(30); EventQueue.invokeLater(new Runnable() { @Override public void run() { pt.setDividerLocation(1.0d); EventQueue.invokeLater(new Runnable() { @Override public void run() { pb.setDividerLocation(0.38); } }); } }); } }); pt.setTopComponent(ptt); pt.setBottomComponent(ptb); ptb.setViewportView(ptba); ptb.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); pb.setTopComponent(pbt); pb.setBottomComponent(pbb); pbb.setViewportView(pbba); pbb.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); tableColumnTable = new javax.swing.JTable() { public void editingStopped(ChangeEvent e) { TableCellEditor editor = this.getCellEditor(); if (editor != null) { Object value = editor.getCellEditorValue(); setTableColumnValue(value); } // System.out.println(MessageFormat.format("c:{0}-r:{1}", // this.getSelectedColumn(), this.getSelectedRow())); super.editingStopped(e); } }; // ColumnModel?false; // table.setAutoCreateColumnsFromModel(false); ptt.setViewportView(tableColumnTable); /** * add by 2016422 ; */ listColumnTable = new javax.swing.JTable() { public void editingStopped(ChangeEvent e) { TableCellEditor editor = this.getCellEditor(); if (editor != null) { Object value = editor.getCellEditorValue(); setListColumnValue(value); } // System.out.println(MessageFormat.format("c:{0}-r:{1}", // this.getSelectedColumn(), this.getSelectedRow())); super.editingStopped(e); } }; listColumnTable.getTableHeader().addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { } }); pbt.setViewportView(listColumnTable); jLabel1 = new javax.swing.JLabel(); basePackageName = new javax.swing.JTextField(); btnGen = new javax.swing.JButton(); btnListColumnOk = new javax.swing.JButton(); btnTableColumnOk = new javax.swing.JButton(); jLabel2 = new javax.swing.JLabel(); jcombo_sqlMapMarkUse = new javax.swing.JComboBox<Option<Integer>>(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); jLabel10 = new javax.swing.JLabel(); jLabel11 = new javax.swing.JLabel(); jLabel12 = new javax.swing.JLabel(); jLabel13 = new javax.swing.JLabel(); jLabel14 = new javax.swing.JLabel(); jLabel15 = new javax.swing.JLabel(); jLabel16 = new javax.swing.JLabel(); columnTitle = new javax.swing.JTextField(); listTitle = new javax.swing.JTextField(); jcombo_showGsonAnnotation = new javax.swing.JComboBox<Option<Boolean>>(); jcombo_queryRenderShow = new javax.swing.JComboBox<Option<Boolean>>(); jcombo_listRenderShow = new javax.swing.JComboBox<Option<Boolean>>(); jcombo_editRenderShow = new javax.swing.JComboBox<Option<Boolean>>(); jcombo_queryRenderWay = new javax.swing.JComboBox<Option<Integer>>(); jcombo_listRenderWay = new javax.swing.JComboBox<Option<Integer>>(); jcombo_editRenderWay = new javax.swing.JComboBox<Option<Integer>>(); saveMethodPrefix = new javax.swing.JTextField(); updateMethodPrefix = new javax.swing.JTextField(); getMethodPrefix = new javax.swing.JTextField(); deleteMethodPrefix = new javax.swing.JTextField(); queryMethodPrefix = new javax.swing.JTextField(); queryPagingMethodPrefix = new javax.swing.JTextField(); queryColumnJson = new javax.swing.JTextArea(1, 10); javax.swing.JScrollPane cqpc = new javax.swing.JScrollPane(queryColumnJson); // customQueryProperty.setAutoscrolls(true); editValueGenWayJson = new javax.swing.JTextArea(1, 10); javax.swing.JScrollPane cevfw = new javax.swing.JScrollPane(editValueGenWayJson); // editValidateJson = new javax.swing.JTextArea(1, 10); // javax.swing.JScrollPane evj = new javax.swing.JScrollPane(editValidateJson); editValidateEasyuiString = new javax.swing.JTextArea(1, 10); javax.swing.JScrollPane evj = new javax.swing.JScrollPane(editValidateEasyuiString); jLabel1.setText("??"); btnGen.setText("?"); btnTableColumnOk.setText("Ok"); btnListColumnOk.setText("Ok"); jLabel2.setText("SQL??"); // sqlMapMarkUse.setModel(null); jLabel3.setText("??"); jLabel4.setText("?"); jLabel5.setText("??"); jLabel6.setText("?"); jLabel7.setText("?"); jLabel8.setText("?"); jLabel9.setText("?gosn"); jLabel10.setText("?"); jLabel11.setText("?"); jLabel12.setText("?"); jLabel13.setText("?"); jLabel14.setText("?"); jLabel15.setText("?"); jLabel16.setText(""); TableLayout tableLayout_ptba = new TableLayout(); double border = 2; // 0 1 2 3 4 5 6 tableLayout_ptba.setColumn(new double[] { border, 50, 50, 80, -1, 50, 70, border }); tableLayout_ptba.setRow(new double[] { border, 30, 30, 30, 130, 130, 130, border }); ptba.setLayout(tableLayout_ptba); queryRenderShow.addElement(CollectionHelper.option("", Boolean.TRUE)); queryRenderShow.addElement(CollectionHelper.option("?", Boolean.FALSE)); jcombo_queryRenderShow.setModel(queryRenderShow); listRenderShow.addElement(CollectionHelper.option("", Boolean.TRUE)); listRenderShow.addElement(CollectionHelper.option("?", Boolean.FALSE)); jcombo_listRenderShow.setModel(listRenderShow); editRenderShow.addElement(CollectionHelper.option("", Boolean.TRUE)); editRenderShow.addElement(CollectionHelper.option("?", Boolean.FALSE)); jcombo_editRenderShow.setModel(editRenderShow); CollectionHelper.renderWayOption(queryRenderWay, "query"); jcombo_queryRenderWay.setModel(queryRenderWay); CollectionHelper.renderWayOption(listRenderWay, "list"); jcombo_listRenderWay.setModel(listRenderWay); CollectionHelper.renderWayOption(editRenderWay, "edit"); jcombo_editRenderWay.setModel(editRenderWay); jcombo_editRenderWay.addItemListener(new ItemListener() { @SuppressWarnings("unchecked") @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { //?? Option<Integer> o = (Option<Integer>) e.getItem(); String s = EditValueGenWayHelper.toEditValueShowWayJson(o.getValue()); editRenderWayJson.setText(s); } } }); int row = 1; ptba.add(new JLabel(""), MessageFormat.format("1,{0},2,{0}", row)); ptba.add(columnTitle, MessageFormat.format("3,{0},4,{0}", row)); ptba.add(btnTableColumnOk, MessageFormat.format("6,{0}", row)); row++; ptba.add(jLabel14, MessageFormat.format("1,{0},2,{0}", row)); ptba.add(jcombo_editRenderShow, MessageFormat.format("3,{0},4,{0}", row)); ptba.add(btnListColumnOk, MessageFormat.format("6,{0}", row)); row++; ptba.add(jLabel15, MessageFormat.format("1,{0},2,{0}", row)); ptba.add(jcombo_editRenderWay, MessageFormat.format("3,{0},4,{0}", row)); row++; ptba.add(new JLabel("?"), MessageFormat.format("1,{0},2,{0}", row)); editRenderWayJson = new javax.swing.JTextArea(1, 10); editRenderWayJson.setLineWrap(true); editRenderWayJson.setWrapStyleWord(true); javax.swing.JScrollPane erwjj = new javax.swing.JScrollPane(editRenderWayJson); ptba.add(erwjj, MessageFormat.format("3,{0},6,{0}", row)); row++; JLabel j1 = new JLabel("?"); j1.setToolTipText("<html>\n" + "<table border=\"1\">\n" + "<tr>\n" + " <th>?</th>\n" + " <th>??</th>\n" + "</tr>\n" + "<tr>\n" + " <td>new</td>\n" + " <td>?,\"input\":, \"time\":??, \"nothing\":??</td>\n" + "</tr>\n" + "</table>\n" + "</html>"); ptba.add(j1, MessageFormat.format("1,{0},2,{0}", row)); ptba.add(cevfw, MessageFormat.format("3,{0},6,{0}", row)); row++; ptba.add(new JLabel("JS?"), MessageFormat.format("1,{0},2,{0}", row)); ptba.add(evj, MessageFormat.format("3,{0},6,{0}", row)); // showGsonAnnotation.setModel(null); btnGen.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnGenActionPerformed(evt); } }); btnListColumnOk.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnListColumnOkActionPerformed(evt); } }); btnTableColumnOk.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnTableColumnOkActionPerformed(evt); } }); TableLayout tableLayout_pbba = new TableLayout(); // double border = 2; //0 1 2 3 4 5 6 tableLayout_pbba.setColumn(new double[] { border, 50, 50, 80, -1, 50, 70, border }); tableLayout_pbba.setRow(new double[] { border, 30, 30, 30, 30, 30, 130, border }); pbba.setLayout(tableLayout_pbba); row = 1; pbba.add(jLabel16, MessageFormat.format("1,{0},2,{0}", row)); pbba.add(listTitle, MessageFormat.format("3,{0},4,{0}", row)); pbba.add(btnListColumnOk, MessageFormat.format("6,{0}", row)); row++; pbba.add(jLabel12, MessageFormat.format("1,{0},2,{0}", row)); pbba.add(jcombo_listRenderShow, MessageFormat.format("3,{0},4,{0}", row)); row++; pbba.add(jLabel13, MessageFormat.format("1,{0},2,{0}", row)); pbba.add(jcombo_listRenderWay, MessageFormat.format("3,{0},4,{0}", row)); row++; pbba.add(jLabel10, MessageFormat.format("1,{0},2,{0}", row, row)); pbba.add(jcombo_queryRenderShow, MessageFormat.format("3,{0},4,{0}", row)); row++; pbba.add(jLabel11, MessageFormat.format("1,{0},2,{0}", row)); pbba.add(jcombo_queryRenderWay, MessageFormat.format("3,{0},4,{0}", row)); row++; pbba.add(new JLabel(""), MessageFormat.format("1,{0},2,{0}", row)); pbba.add(cqpc, MessageFormat.format("3,{0},6,{0}", row)); // TableLayout tableLayout_pba = new TableLayout(); //// double border = 2; //0 1 2 3 4 5 6 // tableLayout_pba.setColumn(new double[]{border, 50, 50, 80, -1, 50, // 70, border}); // tableLayout_pba.setRow(new double[]{border,30, 30, 30, 30, 30, 30, // 30, 30, 30, 30, border}); // pba.setLayout(tableLayout_pba); // // pba.add(jLabel1, "1,1,2,1"); // pba.add(basePackageName, "3,1,5,1"); // pba.add(btnGen, "6,1"); // // pba.add(jLabel2, "1,2,2,2"); // pba.add(jcombo_sqlMapMarkUse, "3,2,4,2"); // // pba.add(jLabel9, "1,3,2,3"); // pba.add(jcombo_showGsonAnnotation, "3,3,4,3"); // // pba.add(jLabel3, "1,4,2,4"); // pba.add(saveMethodPrefix, "3,4,4,4"); // // pba.add(jLabel4, "1,5,2,5"); // pba.add(updateMethodPrefix, "3,5,4,5"); // // pba.add(jLabel5, "1,6,2,6"); // pba.add(getMethodPrefix, "3,6,4,6"); // // pba.add(jLabel6, "1,7,2,7"); // pba.add(deleteMethodPrefix, "3,7,4,7"); // // pba.add(jLabel7, "1,8,2,8"); // pba.add(queryMethodPrefix, "3,8,4,8"); // // pba.add(jLabel8, "1,9,2,9"); // pba.add(queryPagingMethodPrefix, "3,9,4,9"); sqlMapMarkUse.addElement(CollectionHelper.option("??", 1)); sqlMapMarkUse.addElement(CollectionHelper.option("??", 2)); jcombo_sqlMapMarkUse.setModel(sqlMapMarkUse); showGsonAnnotation.addElement(CollectionHelper.option("", Boolean.TRUE)); showGsonAnnotation.addElement(CollectionHelper.option("?", Boolean.FALSE)); jcombo_showGsonAnnotation.setModel(showGsonAnnotation); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(p, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 470, Short.MAX_VALUE)); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent( p, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 446, Short.MAX_VALUE)); this.addComponentListener(new java.awt.event.ComponentAdapter() { public void componentShown(java.awt.event.ComponentEvent evt) { afterShow(evt); } }); pack(); }
From source file:edu.scripps.fl.pubchem.xmltool.gui.GUIComponent.java
public JTextPane createJTextPane(String text) { JTextPane jtp = new JTextPane(); jtp.setText(text);// w w w . jav a 2s. c om SimpleAttributeSet underline = new SimpleAttributeSet(); StyleConstants.setUnderline(underline, true); jtp.getStyledDocument().setCharacterAttributes(0, text.length(), underline, true); jtp.setEditable(false); jtp.setOpaque(false); jtp.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 10)); jtp.setBorder(BorderFactory.createEmptyBorder()); jtp.setForeground(Color.blue); jtp.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); return jtp; }
From source file:net.sf.jabref.gui.MainTable.java
public MainTable(MainTableFormat tableFormat, EventList<BibtexEntry> list, JabRefFrame frame, BasePanel panel) { super();//from w w w . j a v a2 s . c o m addFocusListener(Globals.focusListener); setAutoResizeMode(Globals.prefs.getInt(JabRefPreferences.AUTO_RESIZE_MODE)); this.tableFormat = tableFormat; this.panel = panel; // This SortedList has a Comparator controlled by the TableComparatorChooser // we are going to install, which responds to user sorting selections: sortedForTable = new SortedList<>(list, null); // This SortedList applies afterwards, and floats marked entries: sortedForMarking = new SortedList<>(sortedForTable, null); // This SortedList applies afterwards, and can float search hits: sortedForSearch = new SortedList<>(sortedForMarking, null); // This SortedList applies afterwards, and can float grouping hits: sortedForGrouping = new SortedList<>(sortedForSearch, null); searchMatcher = null; groupMatcher = null; searchComparator = null; groupComparator = null; DefaultEventTableModel<BibtexEntry> tableModel = (DefaultEventTableModel<BibtexEntry>) GlazedListsSwing .eventTableModelWithThreadProxyList(sortedForGrouping, tableFormat); setModel(tableModel); tableColorCodes = Globals.prefs.getBoolean(JabRefPreferences.TABLE_COLOR_CODES_ON); localSelectionModel = (DefaultEventSelectionModel<BibtexEntry>) GlazedListsSwing .eventSelectionModelWithThreadProxyList(sortedForGrouping); setSelectionModel(localSelectionModel); pane = new JScrollPane(this); pane.setBorder(BorderFactory.createEmptyBorder()); pane.getViewport().setBackground(Globals.prefs.getColor(JabRefPreferences.TABLE_BACKGROUND)); setGridColor(Globals.prefs.getColor(JabRefPreferences.GRID_COLOR)); if (Globals.prefs.getBoolean(JabRefPreferences.TABLE_SHOW_GRID)) { setShowGrid(true); } else { setShowGrid(false); setIntercellSpacing(new Dimension(0, 0)); } this.setTableHeader(new PreventDraggingJTableHeader(this.getColumnModel())); comparatorChooser = this.createTableComparatorChooser(this, sortedForTable, TableComparatorChooser.MULTIPLE_COLUMN_KEYBOARD); this.tableColumnListener = new PersistenceTableColumnListener(this); // TODO: Figure out, whether this call is needed. getSelected(); // enable DnD setDragEnabled(true); TransferHandler xfer = new EntryTableTransferHandler(this, frame, panel); setTransferHandler(xfer); pane.setTransferHandler(xfer); setupComparatorChooser(); refreshSorting(); setWidths(); }
From source file:de.tbuchloh.kiskis.gui.SecuredElementView.java
private Component createTabs() { final JTabbedPane p = new PersistentTabPane(getClass().getName() + ".bottomFields", //$NON-NLS-1$ SwingConstants.BOTTOM); p.addTab(M.getString("NAME"), createMainTab()); //$NON-NLS-1$ p.addTab(M.getString("attachments.title"), //$NON-NLS-1$ _attachmentBox);/*from w ww. ja v a 2 s . co m*/ p.addTab(M.getString("STATISTICS"), //$NON-NLS-1$ createStatisticTab()); p.addTab(M.getString("comment_border_title"), //$NON-NLS-1$ createCommentTab()); p.setBorder(BorderFactory.createEmptyBorder()); return createTitledPanel(M.getString("border_title"), p); //$NON-NLS-1$ }
From source file:de.unidue.inf.is.ezdl.gframedl.components.AboutDialog.java
private JPanel getContent() { JPanel panel = new JPanel(new GridBagLayout()); JLabel iconLabel = new JLabel(new ImageIcon(Images.LOGO_EZDL_LARGE_SINGLE.getImage())); JTextArea licenseTextArea = new JTextArea(licenseText); licenseTextArea.setEditable(false);//from w ww . ja v a 2s . c o m licenseTextArea.setLineWrap(true); licenseTextArea.setWrapStyleWord(true); licenseTextArea.setOpaque(false); licenseTextArea.setBorder(BorderFactory.createEmptyBorder()); JScrollPane licenseScrollPane = new JScrollPane(licenseTextArea); JTable propertiesTable = new JTable(tableModel); propertiesTable.setBackground(Color.WHITE); propertiesTable.setShowGrid(false); JScrollPane propertiesScrollPane = new JScrollPane(propertiesTable); propertiesScrollPane.setBackground(Color.WHITE); propertiesScrollPane.getViewport().setBackground(Color.WHITE); JButton closeButton = new JButton(I18nSupport.getInstance().getLocString("ezdl.controls.close")); closeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { dispose(); } }); JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.addTab(I18nSupport.getInstance().getLocString("ezdl.licence"), licenseScrollPane); tabbedPane.addTab(I18nSupport.getInstance().getLocString("ezdl.properties"), propertiesScrollPane); tabbedPane.setBackground(Color.WHITE); GridBagConstraints c = new GridBagConstraints(); c.gridx = 0; c.gridy = 0; c.insets = new Insets(0, 0, 0, 0); c.anchor = GridBagConstraints.CENTER; panel.add(iconLabel, c); c.gridx = 0; c.gridy = 1; c.weightx = 1; c.weighty = 1; c.anchor = GridBagConstraints.CENTER; c.fill = GridBagConstraints.BOTH; c.insets = new Insets(10, 20, 10, 20); panel.add(tabbedPane, c); c.gridy = 2; c.fill = GridBagConstraints.NONE; c.weighty = 0; c.insets = new Insets(0, 20, 10, 20); panel.add(closeButton, c); panel.setBackground(Color.WHITE); return panel; }
From source file:mergedoc.ui.PreferencePanel.java
/** * ??????//from w w w . j a v a 2 s . c o m * @return ?? * @throws MergeDocException ???????? */ private JComponent createLowerPanel() throws MergeDocException { // ??? JPanel checkPanel = new JPanel(); checkPanel.setLayout(new BoxLayout(checkPanel, BoxLayout.Y_AXIS)); List<ReplaceEntry> list = ConfigManager.getInstance().getGlobalEntries(); for (ReplaceEntry entry : list) { EntryCheckBox cb = new EntryCheckBox(entry); cb.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { previewScrollPane.updatePreview(entryCheckList); } }); checkPanel.add(cb); entryCheckList.add(cb); } JScrollPane checkScrollPane = ComponentFactory.createScrollPane(checkPanel); checkScrollPane.getVerticalScrollBar().setUnitIncrement(10); // ? previewScrollPane = new PreviewScrollPane(); // ?? splitPane.setBorder(BorderFactory.createEmptyBorder()); splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT); splitPane.setContinuousLayout(true); splitPane.setTopComponent(checkScrollPane); splitPane.setBottomComponent(previewScrollPane); JPanel splitPanel = new JPanel(); splitPanel.setLayout(new BoxLayout(splitPanel, BoxLayout.X_AXIS)); splitPanel.add(splitPane); // ?? JPanel panel = new TitledPanel(""); panel.setMaximumSize(ComponentFactory.createMaxDimension()); panel.add(splitPanel); // ??? Persister psst = Persister.getInstance(); int loc = psst.getInt(Persister.DETAIL_PANEL_HEIGHT, 88); splitPane.setDividerLocation(loc); // ??? String[] pDescs = psst.getStrings(Persister.REPLACE_DESCRIPTION_ARRAY); for (EntryCheckBox ecb : entryCheckList) { ReplaceEntry entry = ecb.getReplaceEntry(); String desc = entry.getDescription(); for (String pDesc : pDescs) { if (desc.equals(pDesc)) { ecb.setSelected(true); break; } } } previewScrollPane.updatePreview(entryCheckList); return panel; }
From source file:com.rapidminer.gui.graphs.GraphViewer.java
public GraphViewer(final GraphCreator<V, E> graphCreator) { try {//w w w. j av a 2s . co m if (!RapidMiner.getExecutionMode().isHeadless()) { graphMouse = new DefaultModalGraphMouse(1 / 1.1f, 1.1f); } } catch (HeadlessException e) { } this.graphCreator = graphCreator; setLayout(new BorderLayout()); Graph<V, E> graph = graphCreator.createGraph(); this.layoutSelection = new LayoutSelection<>(this, graph); this.layout = new ISOMLayout<>(graph); vv = new VisualizationViewer<V, E>(layout) { private static final long serialVersionUID = 8247229781249216143L; private boolean initialized = false; /** * Necessary in order to re-change layout after first painting (starting position and * size). */ @Override public void paint(Graphics g) { super.paint(g); if (!initialized) { initialized = true; updateLayout(); if (objectViewerSplitPane != null) { objectViewerSplitPane.setDividerLocation(0.9); } } } }; vv.setBorder(BorderFactory.createEmptyBorder()); vv.setBackground(Color.white); // === design === // ## edge layout ## // EDGE SHAPE int edgeShapeType = graphCreator.getEdgeShape(); switch (edgeShapeType) { case GraphCreator.EDGE_SHAPE_LINE: vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line<V, E>()); break; case GraphCreator.EDGE_SHAPE_QUAD_CURVE: vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.QuadCurve<V, E>()); break; case GraphCreator.EDGE_SHAPE_CUBIC_CURVE: vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.CubicCurve<V, E>()); break; case GraphCreator.EDGE_SHAPE_BENT_LINE: vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.BentLine<V, E>()); break; case GraphCreator.EDGE_SHAPE_WEDGE: vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Wedge<V, E>(5)); break; default: vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line<V, E>()); break; } // EDGE FONT vv.getRenderContext().setEdgeFontTransformer(new Transformer<E, Font>() { @Override public Font transform(E arg0) { return EDGE_FONT; } }); // EDGE COLORS vv.getRenderContext().setEdgeDrawPaintTransformer(new Transformer<E, Paint>() { @Override public Paint transform(E edge) { double edgeStrength = graphCreator.getEdgeStrength(edge); int value = (int) Math.max(140, Math.min(230, 230 - edgeStrength * 90)); return new Color(value, value, value); } }); vv.getRenderContext().setArrowDrawPaintTransformer(new Transformer<E, Paint>() { @Override public Paint transform(E edge) { double edgeStrength = graphCreator.getEdgeStrength(edge); int value = (int) Math.max(140, Math.min(230, 230 - edgeStrength * 90)); return new Color(value, value, value).darker(); } }); vv.getRenderContext().setArrowFillPaintTransformer(new Transformer<E, Paint>() { @Override public Paint transform(E edge) { double edgeStrength = graphCreator.getEdgeStrength(edge); int value = (int) Math.max(140, Math.min(230, 230 - edgeStrength * 90)); return new Color(value, value, value); } }); // EDGE LABEL POSITION vv.getRenderContext() .setEdgeLabelClosenessTransformer(new ConstantDirectionalEdgeValueTransformer<V, E>(0.5d, 0.5d)); int labelOffset = graphCreator.getLabelOffset(); if (labelOffset >= 0) { vv.getRenderContext().setLabelOffset(labelOffset); } // EDGE LABELS vv.getRenderContext().setEdgeLabelTransformer(new Transformer<E, String>() { @Override public String transform(E object) { return graphCreator.getEdgeName(object); } }); // EDGE LABEL RENDERER Renderer.EdgeLabel<V, E> edgeLabelRenderer = graphCreator.getEdgeLabelRenderer(); if (edgeLabelRenderer != null) { vv.getRenderer().setEdgeLabelRenderer(edgeLabelRenderer); // renderer... } vv.getRenderContext().setEdgeLabelRenderer(new EdgeLabelRenderer() { // ...context! private JLabel renderer = new JLabel(); @Override public <T> Component getEdgeLabelRendererComponent(JComponent parent, Object value, Font font, boolean isSelected, T edge) { this.renderer.setFont(font); if (graphCreator.isEdgeLabelDecorating()) { this.renderer.setOpaque(true); renderer.setBackground(Color.WHITE); // use this for a more fancy look and feel // renderer.setBackground(SwingTools.TRANSPARENT_YELLOW); // this.renderer.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(SwingTools.DARK_BLUE), // BorderFactory.createEmptyBorder(1,1,1,1))); } this.renderer.setText(value.toString()); return this.renderer; } /** Let the graph model decide. */ @Override public boolean isRotateEdgeLabels() { return graphCreator.isRotatingEdgeLabels(); } /** Does nothing. */ @Override public void setRotateEdgeLabels(boolean rotate) { } }); // ## vertex layout ## // VERTEX FONT vv.getRenderContext().setVertexFontTransformer(new Transformer<V, Font>() { @Override public Font transform(V vertex) { if (graphCreator.isBold(vertex)) { return VERTEX_BOLD_FONT; } else { return VERTEX_PLAIN_FONT; } } }); // VERTEX NAME vv.getRenderContext().setVertexLabelTransformer(new Transformer<V, String>() { @Override public String transform(V object) { return graphCreator.getVertexName(object); } }); // VERTEX FILL PAINT Transformer<V, Paint> paintTransformer = graphCreator.getVertexPaintTransformer(vv); if (paintTransformer == null) { paintTransformer = new Transformer<V, Paint>() { @Override public Paint transform(V vertex) { if (vv.getPickedVertexState().isPicked(vertex)) { return SwingTools.LIGHT_YELLOW; } else { return SwingTools.LIGHT_BLUE; } } }; } vv.getRenderContext().setVertexFillPaintTransformer(paintTransformer); // VERTEX DRAW PAINT vv.getRenderContext().setVertexDrawPaintTransformer(new Transformer<V, Paint>() { @Override public Paint transform(V vertex) { if (vv.getPickedVertexState().isPicked(vertex)) { return SwingTools.DARKEST_YELLOW.darker(); } else { return SwingTools.DARKEST_BLUE.darker(); } } }); // VERTEX TOOL TIP this.vv.setVertexToolTipTransformer(new Transformer<V, String>() { @Override public String transform(V vertex) { return graphCreator.getVertexToolTip(vertex); } }); // VERTEX SHAPE vv.getRenderContext().setVertexShapeTransformer(new ExtendedVertexShapeTransformer<>(graphCreator)); // VERTEX RENDERER Renderer.Vertex<V, E> vertexRenderer = graphCreator.getVertexRenderer(); if (vertexRenderer != null) { vv.getRenderer().setVertexRenderer(vertexRenderer); } // VERTEX LABEL RENDERER setDefaultLabelPosition(); // custom renderer? Renderer.VertexLabel<V, E> customVertexLabelRenderer = graphCreator.getVertexLabelRenderer(); if (customVertexLabelRenderer != null) { vv.getRenderer().setVertexLabelRenderer(customVertexLabelRenderer); } // context vv.getRenderContext().setVertexLabelRenderer(new VertexLabelRenderer() { private JLabel label = new JLabel(); @Override public <T> Component getVertexLabelRendererComponent(JComponent parent, Object object, Font font, boolean isSelection, T vertex) { label.setFont(font); if (object != null) { label.setText(object.toString()); } else { label.setText(""); } return label; } }); // === end of design === // === main panel === if (graphCreator.getObjectViewer() == null) { add(vv, BorderLayout.CENTER); } else { JComponent viewer = graphCreator.getObjectViewer().getViewerComponent(); if (viewer != null) { viewer.setBorder(null); objectViewerSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); objectViewerSplitPane.setResizeWeight(1); objectViewerSplitPane.add(vv, 0); objectViewerSplitPane.add(viewer, 1); add(objectViewerSplitPane, BorderLayout.CENTER); } else { add(vv, BorderLayout.CENTER); } } // === control panel === Component controlPanel = createControlPanel(); add(new ExtendedJScrollPane(controlPanel), BorderLayout.WEST); this.showEdgeLabels = !graphCreator.showEdgeLabelsDefault(); togglePaintEdgeLabels(); this.showVertexLabels = !graphCreator.showVertexLabelsDefault(); togglePaintVertexLabels(); this.layoutSelection.setLayout(); }
From source file:com.mirth.connect.client.ui.NotificationDialog.java
private void initComponents() { setLayout(new MigLayout("insets 12", "[]", "[fill][]")); notificationPanel = new JPanel(); notificationPanel.setLayout(new MigLayout("insets 0 0 0 0, fill", "[200!][]", "[25!]0[]")); notificationPanel.setBackground(UIConstants.BACKGROUND_COLOR); archiveAll = new JLabel("Archive All"); archiveAll.setForeground(java.awt.Color.blue); archiveAll.setText("<html><u>Archive All</u></html>"); archiveAll.setToolTipText("Archive all notifications below."); archiveAll.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); newNotificationsLabel = new JLabel(); newNotificationsLabel.setFont(newNotificationsLabel.getFont().deriveFont(Font.BOLD)); headerListPanel = new JPanel(); headerListPanel.setBackground(UIConstants.HIGHLIGHTER_COLOR); headerListPanel.setLayout(new MigLayout("insets 2, fill")); headerListPanel.setBorder(BorderFactory.createLineBorder(borderColor)); list = new JList(); list.setCellRenderer(new NotificationListCellRenderer()); list.addListSelectionListener(new ListSelectionListener() { @Override//from w w w .j a v a 2 s . c o m public void valueChanged(ListSelectionEvent event) { if (!event.getValueIsAdjusting()) { currentNotification = (Notification) list.getSelectedValue(); if (currentNotification != null) { notificationNameTextField.setText(currentNotification.getName()); contentTextPane.setText(currentNotification.getContent()); archiveSelected(); } } } }); listScrollPane = new JScrollPane(); listScrollPane.setBackground(UIConstants.BACKGROUND_COLOR); listScrollPane.setBorder(BorderFactory.createMatteBorder(0, 1, 1, 1, borderColor)); listScrollPane.setViewportView(list); listScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); archiveLabel = new JLabel(); archiveLabel.setForeground(java.awt.Color.blue); archiveLabel.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); notificationNameTextField = new JTextField(); notificationNameTextField.setFont(notificationNameTextField.getFont().deriveFont(Font.BOLD)); notificationNameTextField.setEditable(false); notificationNameTextField.setFocusable(false); notificationNameTextField.setBorder(BorderFactory.createEmptyBorder()); notificationNameTextField.setBackground(UIConstants.HIGHLIGHTER_COLOR); DefaultCaret nameCaret = (DefaultCaret) notificationNameTextField.getCaret(); nameCaret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE); headerContentPanel = new JPanel(); headerContentPanel.setLayout(new MigLayout("insets 2, fill")); headerContentPanel.setBorder(BorderFactory.createLineBorder(borderColor)); headerContentPanel.setBackground(UIConstants.HIGHLIGHTER_COLOR); contentTextPane = new JTextPane(); contentTextPane.setContentType("text/html"); contentTextPane.setEditable(false); contentTextPane.addHyperlinkListener(new HyperlinkListener() { public void hyperlinkUpdate(HyperlinkEvent evt) { if (evt.getEventType() == EventType.ACTIVATED && Desktop.isDesktopSupported()) { try { if (Desktop.isDesktopSupported()) { Desktop.getDesktop().browse(evt.getURL().toURI()); } else { BareBonesBrowserLaunch.openURL(evt.getURL().toString()); } } catch (Exception e) { e.printStackTrace(); } } } }); DefaultCaret contentCaret = (DefaultCaret) contentTextPane.getCaret(); contentCaret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE); contentScrollPane = new JScrollPane(); contentScrollPane.setViewportView(contentTextPane); contentScrollPane.setBorder(BorderFactory.createMatteBorder(0, 1, 1, 1, borderColor)); archiveLabel.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { int index = list.getSelectedIndex(); if (currentNotification.isArchived()) { notificationModel.setArchived(false, index); unarchivedCount++; } else { notificationModel.setArchived(true, index); unarchivedCount--; } archiveSelected(); updateUnarchivedCountLabel(); } }); archiveAll.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { for (int i = 0; i < notificationModel.getSize(); i++) { notificationModel.setArchived(true, i); } unarchivedCount = 0; archiveSelected(); updateUnarchivedCountLabel(); } }); notificationCheckBox = new JCheckBox("Show new notifications on login"); notificationCheckBox.setBackground(UIConstants.BACKGROUND_COLOR); if (checkForNotifications == null || BooleanUtils.toBoolean(checkForNotifications)) { checkForNotificationsSetting = true; if (showNotificationPopup == null || BooleanUtils.toBoolean(showNotificationPopup)) { notificationCheckBox.setSelected(true); } else { notificationCheckBox.setSelected(false); } } else { notificationCheckBox.setSelected(false); } notificationCheckBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (notificationCheckBox.isSelected() && !checkForNotificationsSetting) { alertSettingsChange(); } } }); closeButton = new JButton("Close"); closeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { doSave(); } }); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { doSave(); } }); }