List of usage examples for javax.swing BorderFactory createMatteBorder
public static MatteBorder createMatteBorder(int top, int left, int bottom, int right, Icon tileIcon)
From source file:com.mirth.connect.manager.HeapSizeDialog.java
private void initLayout() { setLayout(new MigLayout("insets 8, novisualpadding, hidemode 3, fill")); JPanel panel = new JPanel(new MigLayout("insets 4, novisualpadding, hidemode 3, fill")); panel.setBackground(Color.white); panel.setBorder(BorderFactory.createTitledBorder( BorderFactory.createMatteBorder(1, 1, 1, 1, new Color(204, 204, 204)), "Web Start Settings", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Tahoma", 1, 11))); panel.add(new JLabel("Max Heap Size:"), "split"); panel.add(heapSizeComboBox, "w 75!, left, wrap"); panel.add(warningLabel, "split"); add(panel);/*from ww w . ja v a 2 s. c o m*/ add(new JSeparator(), "newline, growx, sx"); add(okButton, "newline, h 22!, w 56!, sx, right, split"); add(cancelButton, "h 22!, w 56!"); }
From source file:net.sf.vfsjfilechooser.accessories.bookmarks.BookmarksManagerPanel.java
public BookmarksManagerPanel(BookmarksDialog parentDialog, VFSJFileChooser chooser) { this.parentDialog = parentDialog; this.chooser = chooser; model = new Bookmarks(); table = new JTable(model); scrollPane = new JScrollPane(table); table.setPreferredScrollableViewportSize(tableSize); table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); bCancel = new JButton(VFSResources.getMessage("VFSJFileChooser.closeButtonText")); bOpen = new JButton(VFSResources.getMessage("VFSJFileChooser.openButtonText")); bOpen.setIcon(/*w ww.jav a 2s. co m*/ new ImageIcon(getClass().getResource("/net/sf/vfsjfilechooser/plaf/icons/document-open.png"))); bOpen.setHorizontalAlignment(SwingConstants.LEFT); bAdd = new JButton(VFSResources.getMessage("VFSJFileChooser.addButtonText")); bAdd.setIcon(new ImageIcon(getClass().getResource("/net/sf/vfsjfilechooser/plaf/icons/list-add.png"))); bAdd.setHorizontalAlignment(SwingConstants.LEFT); bEdit = new JButton(VFSResources.getMessage("VFSJFileChooser.editButtonText")); bEdit.setIcon(new ImageIcon(getClass().getResource("/net/sf/vfsjfilechooser/plaf/icons/book_edit.png"))); bEdit.setHorizontalAlignment(SwingConstants.LEFT); bDelete = new JButton(VFSResources.getMessage("VFSJFileChooser.deleteButtonText")); bDelete.setIcon( new ImageIcon(getClass().getResource("/net/sf/vfsjfilechooser/plaf/icons/list-remove.png"))); bDelete.setHorizontalAlignment(SwingConstants.LEFT); bMoveUp = new JButton(VFSResources.getMessage("VFSJFileChooser.moveUpButtonText")); bMoveUp.setIcon(new ImageIcon(getClass().getResource("/net/sf/vfsjfilechooser/plaf/icons/go-up.png"))); bMoveUp.setHorizontalAlignment(SwingConstants.LEFT); bMoveDown = new JButton(VFSResources.getMessage("VFSJFileChooser.moveDownButtonText")); bMoveDown.setIcon(new ImageIcon(getClass().getResource("/net/sf/vfsjfilechooser/plaf/icons/go-down.png"))); bMoveDown.setHorizontalAlignment(SwingConstants.LEFT); final ActionHandler ah = new ActionHandler(); bOpen.addActionListener(ah); bCancel.addActionListener(ah); bEdit.addActionListener(ah); bAdd.addActionListener(ah); bDelete.addActionListener(ah); bMoveUp.addActionListener(ah); bMoveDown.addActionListener(ah); final Box south = Box.createHorizontalBox(); south.add(Box.createHorizontalGlue()); south.add(bCancel); south.add(Box.createHorizontalGlue()); final JPanel buttons = new JPanel(new GridLayout(0, 1, 5, 5)); buttons.add(bAdd); buttons.add(bEdit); buttons.add(bDelete); buttons.add(bOpen); buttons.add(Box.createVerticalStrut(10)); buttons.add(bMoveUp); buttons.add(bMoveDown); JPanel east = new JPanel(); east.add(buttons, BorderLayout.NORTH); east.add(new JPanel(), BorderLayout.CENTER); // don't ask setLayout(new BorderLayout(10, 10)); add(scrollPane, BorderLayout.CENTER); add(south, BorderLayout.SOUTH); add(east, BorderLayout.EAST); setBorder(BorderFactory.createMatteBorder(10, 10, 10, 10, UIManager.getColor("Panel.background"))); }
From source file:com.hp.alm.ali.idea.content.taskboard.BacklogItemPanel.java
public BacklogItemPanel(Project project, Entity item, TaskBoardFilter filter) { super(new BorderLayout()); this.project = project; this.item = item; this.filter = filter; entityLabelService = project.getComponent(EntityLabelService.class); entityService = project.getComponent(EntityService.class); activeItemService = project.getComponent(ActiveItemService.class); taskBoardConfiguration = project.getComponent(TaskBoardConfiguration.class); taskBoardFlow = project.getComponent(TaskBoardFlow.class); aliProjectConfiguration = project.getComponent(AliProjectConfiguration.class); header = new Header(); header.setBorder(new EmptyBorder(0, 5, 0, 5)); add(header, BorderLayout.NORTH); entityName = new JTextPane(); entityName.setBackground(getBackground()); entityName.setEditable(false);/*from www . j ava 2 s .c o m*/ add(entityName, BorderLayout.CENTER); content = new Content(); content.setBorder(new EmptyBorder(0, 5, 10, 5)); add(content, BorderLayout.SOUTH); tasks = new HashMap<Integer, TaskPanel>(); taskContainers = new HashMap<String, TaskContainerPanel>(); taskContainers.put(TaskPanel.TASK_NEW, new TaskContainerPanel(this, TaskPanel.TASK_NEW, item)); taskContainers.put(TaskPanel.TASK_IN_PROGRESS, new TaskContainerPanel(this, TaskPanel.TASK_IN_PROGRESS, item)); taskContainers.put(TaskPanel.TASK_COMPLETED, new TaskContainerPanel(this, TaskPanel.TASK_COMPLETED, item)); taskContent = new JPanel(new GridLayout(1, 3)); taskContent.add(getTaskContainer(TaskPanel.TASK_NEW)); taskContent.add(getTaskContainer(TaskPanel.TASK_IN_PROGRESS)); taskContent.add(getTaskContainer(TaskPanel.TASK_COMPLETED)); Color gridColor = UIManager.getDefaults().getColor("Table.gridColor"); taskContent.setBorder(BorderFactory.createMatteBorder(0, 1, 1, 0, gridColor)); setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, gridColor)); // we don't use gap in grid layout to avoid trailing line (on the right) getTaskContainer(TaskPanel.TASK_IN_PROGRESS) .setBorder(BorderFactory.createMatteBorder(0, 1, 0, 0, gridColor)); getTaskContainer(TaskPanel.TASK_COMPLETED) .setBorder(BorderFactory.createMatteBorder(0, 1, 0, 0, gridColor)); simpleHighlight = new SimpleHighlight(entityName); setPreferredSize(DIMENSION); update(item); }
From source file:com.googlecode.vfsjfilechooser2.accessories.bookmarks.BookmarksManagerPanel.java
public BookmarksManagerPanel(BookmarksDialog parentDialog, VFSJFileChooser chooser) { this.parentDialog = parentDialog; this.chooser = chooser; model = new Bookmarks(); table = new JTable(model); scrollPane = new JScrollPane(table); table.setPreferredScrollableViewportSize(tableSize); table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); bCancel = new JButton(VFSResources.getMessage("VFSJFileChooser.closeButtonText")); bOpen = new JButton(VFSResources.getMessage("VFSJFileChooser.openButtonText")); bOpen.setIcon(new ImageIcon( getClass().getResource("/com/googlecode/vfsjfilechooser2/plaf/icons/document-open.png"))); bOpen.setHorizontalAlignment(SwingConstants.LEFT); bAdd = new JButton(VFSResources.getMessage("VFSJFileChooser.addButtonText")); bAdd.setIcon(/* w w w .jav a2s. c o m*/ new ImageIcon(getClass().getResource("/com/googlecode/vfsjfilechooser2/plaf/icons/list-add.png"))); bAdd.setHorizontalAlignment(SwingConstants.LEFT); bEdit = new JButton(VFSResources.getMessage("VFSJFileChooser.editButtonText")); bEdit.setIcon( new ImageIcon(getClass().getResource("/com/googlecode/vfsjfilechooser2/plaf/icons/book_edit.png"))); bEdit.setHorizontalAlignment(SwingConstants.LEFT); bDelete = new JButton(VFSResources.getMessage("VFSJFileChooser.deleteButtonText")); bDelete.setIcon(new ImageIcon( getClass().getResource("/com/googlecode/vfsjfilechooser2/plaf/icons/list-remove.png"))); bDelete.setHorizontalAlignment(SwingConstants.LEFT); bMoveUp = new JButton(VFSResources.getMessage("VFSJFileChooser.moveUpButtonText")); bMoveUp.setIcon( new ImageIcon(getClass().getResource("/com/googlecode/vfsjfilechooser2/plaf/icons/go-up.png"))); bMoveUp.setHorizontalAlignment(SwingConstants.LEFT); bMoveDown = new JButton(VFSResources.getMessage("VFSJFileChooser.moveDownButtonText")); bMoveDown.setIcon( new ImageIcon(getClass().getResource("/com/googlecode/vfsjfilechooser2/plaf/icons/go-down.png"))); bMoveDown.setHorizontalAlignment(SwingConstants.LEFT); final ActionHandler ah = new ActionHandler(); bOpen.addActionListener(ah); bCancel.addActionListener(ah); bEdit.addActionListener(ah); bAdd.addActionListener(ah); bDelete.addActionListener(ah); bMoveUp.addActionListener(ah); bMoveDown.addActionListener(ah); final Box south = Box.createHorizontalBox(); south.add(Box.createHorizontalGlue()); south.add(bCancel); south.add(Box.createHorizontalGlue()); final JPanel buttons = new JPanel(new GridLayout(0, 1, 5, 5)); buttons.add(bAdd); buttons.add(bEdit); buttons.add(bDelete); buttons.add(bOpen); buttons.add(Box.createVerticalStrut(10)); buttons.add(bMoveUp); buttons.add(bMoveDown); JPanel east = new JPanel(); east.add(buttons, BorderLayout.NORTH); east.add(new JPanel(), BorderLayout.CENTER); // don't ask setLayout(new BorderLayout(10, 10)); add(scrollPane, BorderLayout.CENTER); add(south, BorderLayout.SOUTH); add(east, BorderLayout.EAST); setBorder(BorderFactory.createMatteBorder(10, 10, 10, 10, UIManager.getColor("Panel.background"))); }
From source file:net.aepik.alasca.gui.util.LoadFileFrame.java
/** * Initialize frame content.//from ww w. j a v a 2 s . c om */ private void initFrame() { // - Panel bouton du bas - JPanel boutonsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); boutonsPanel.add(boutonOk); boutonsPanel.add(boutonAnnuler); // - Panel nom du fichier - JTextArea textAreaFilename = new JTextArea( "Indiquez le nom du fichier contenant les dfinitions du schma LDAP que vous souhaitez charger."); textAreaFilename.setEditable(false); textAreaFilename.setLineWrap(true); textAreaFilename.setWrapStyleWord(true); textAreaFilename.setFont((new JLabel()).getFont()); textAreaFilename.setBorder(BorderFactory.createEmptyBorder(7, 6, 12, 6)); textAreaFilename.setBackground(new Color(240, 235, 226)); boutonOpenFile.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createMatteBorder(0, 5, 0, 0, boutonsPanel.getBackground()), boutonOpenFile.getBorder())); JPanel filenamePanel = new JPanel(new BorderLayout()); filenamePanel.add(textAreaFilename, BorderLayout.NORTH); filenamePanel.add(filename, BorderLayout.CENTER); filenamePanel.add(boutonOpenFile, BorderLayout.EAST); filenamePanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(5, 4, 1, 4), BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(" Schma LDAP "), BorderFactory.createEmptyBorder(0, 5, 5, 5)))); // - Panel du selecteur de syntaxes - JTextArea textAreaSyntaxes = new JTextArea( "Il vous faut appliquer un filtre sur le schma que vous voulez charger. Voici la liste des filtres disponibles :"); textAreaSyntaxes.setEditable(false); textAreaSyntaxes.setLineWrap(true); textAreaSyntaxes.setWrapStyleWord(true); textAreaSyntaxes.setFont((new JLabel()).getFont()); textAreaSyntaxes.setBorder(BorderFactory.createEmptyBorder(7, 6, 12, 6)); textAreaSyntaxes.setBackground(new Color(240, 235, 226)); JPanel syntaxesPanel = new JPanel(new BorderLayout()); syntaxesPanel.add(textAreaSyntaxes, BorderLayout.NORTH); syntaxesPanel.add(syntaxes); syntaxesPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(5, 4, 1, 4), BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(" Syntaxe LDAP "), BorderFactory.createEmptyBorder(0, 5, 5, 5)))); // On injecte le nom des classes de syntaxes possibles // dynamiquement. String[] syntaxesName = Schema.getSyntaxeNames(); for (int i = 0; syntaxesName != null && i < syntaxesName.length; i++) { syntaxes.addItem(syntaxesName[i]); } // - Organisation gnrale - JPanel mainPanel = new JPanel(new BorderLayout()); mainPanel.add(filenamePanel, BorderLayout.NORTH); mainPanel.add(syntaxesPanel, BorderLayout.CENTER); JPanel mainPanelContainer = new JPanel(new BorderLayout()); mainPanelContainer.add(mainPanel, BorderLayout.NORTH); mainPanelContainer.add(boutonsPanel, BorderLayout.SOUTH); mainPanelContainer.setBorder(BorderFactory.createEmptyBorder(2, 1, 1, 1)); getContentPane().add(new DescriptiveInternalFrame(mainFrame.getIconImage(), "Slectionner un fichier et sa syntaxe.", mainPanelContainer)); // - Listeners - addWindowListener(this); boutonOpenFile.addActionListener(this); boutonOk.addActionListener(this); boutonAnnuler.addActionListener(this); }
From source file:net.aepik.alasca.gui.ldap.SchemaObjectEditorFrame.java
/** * Build frame./*from w ww. jav a 2 s. c o 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.haskins.cloudtrailviewer.feature.MetricsFeature.java
private void buildUI() { // toolbar/*from w ww . jav a 2s. c om*/ toolbar.setLayout(new WrapLayout(FlowLayout.CENTER, 1, 1)); toolbar.setFloatable(false); toolbar.setBackground(Color.white); toolbar.setBorder(BorderFactory.createMatteBorder(1, 0, 1, 0, Color.black)); eventTable.setVisible(false); jsp = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true, chartCards, eventTable); jsp.setDividerSize(0); jsp.setResizeWeight(1); jsp.setDividerLocation(jsp.getSize().height - jsp.getInsets().bottom - jsp.getDividerSize()); jsp.setBorder(BorderFactory.createEmptyBorder(1, 0, 0, 0)); this.setLayout(new BorderLayout()); this.add(toolbar, BorderLayout.PAGE_START); this.add(jsp, BorderLayout.CENTER); }
From source file:com.mirth.connect.client.ui.SettingsPanelDatabaseTasks.java
private void initComponents() { JPanel containerPanel = new JPanel(new MigLayout("insets 0, novisualpadding, hidemode 3, fill")); containerPanel.setBackground(getBackground()); containerPanel.setBorder(BorderFactory.createTitledBorder( BorderFactory.createMatteBorder(1, 0, 0, 0, new Color(204, 204, 204)), "Database Tasks", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Tahoma", 1, 11))); containerPanel.add(new JLabel( "Cleanup or optimization tasks for the internal database. If no tasks are present, no action is necessary."), "top, wrap"); taskTable = new MirthTable(); taskTable/*from www . j a va2 s . c o m*/ .setModel(new RefreshTableModel(new Object[] { "Status", "Name", "Description", "Start Time" }, 0)); taskTable.setDragEnabled(false); taskTable.setRowSelectionAllowed(true); taskTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); taskTable.setRowHeight(UIConstants.ROW_HEIGHT); taskTable.setFocusable(false); taskTable.setOpaque(true); taskTable.getTableHeader().setReorderingAllowed(false); taskTable.setEditable(false); if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) { taskTable.setHighlighters(HighlighterFactory.createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR, UIConstants.BACKGROUND_COLOR)); } taskTable.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent evt) { checkSelection(evt); } @Override public void mouseReleased(MouseEvent evt) { checkSelection(evt); } private void checkSelection(MouseEvent evt) { if (taskTable.rowAtPoint(new Point(evt.getX(), evt.getY())) < 0) { taskTable.clearSelection(); setVisibleTasks(2, 3, false); } } }); taskTable.getColumnModel().getColumn(0).setMinWidth(75); taskTable.getColumnModel().getColumn(0).setMaxWidth(75); taskTable.getColumnModel().getColumn(0).setCellRenderer(new ImageCellRenderer()); taskTable.getColumnModel().getColumn(1).setMinWidth(45); taskTable.getColumnModel().getColumn(1).setPreferredWidth(250); taskTable.getColumnModel().getColumn(2).setMinWidth(75); taskTable.getColumnModel().getColumn(2).setPreferredWidth(475); taskTable.getColumnModel().getColumn(3).setMinWidth(95); taskTable.getColumnModel().getColumn(3).setMaxWidth(95); taskTable.getColumnModel().getColumn(3).setCellRenderer(new DateCellRenderer()); taskTable.getSelectionModel().addListSelectionListener(this); JScrollPane taskTableScrollPane = new JScrollPane(taskTable); containerPanel.add(taskTableScrollPane, "grow, push"); add(containerPanel, "grow, h 60%"); JPanel channelsPanel = new JPanel(new MigLayout("insets 0, novisualpadding, hidemode 3, fill")); channelsPanel.setBackground(getBackground()); channelsPanel.setBorder(BorderFactory.createTitledBorder( BorderFactory.createMatteBorder(1, 0, 0, 0, new Color(204, 204, 204)), "Affected Channels", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Tahoma", 1, 11))); channelsTable = new MirthTable(); channelsTable.setModel(new RefreshTableModel(new Object[] { "Name", "Id" }, 0)); channelsTable.setDragEnabled(false); channelsTable.setRowSelectionAllowed(false); channelsTable.setRowHeight(UIConstants.ROW_HEIGHT); channelsTable.setFocusable(false); channelsTable.setOpaque(true); channelsTable.getTableHeader().setReorderingAllowed(false); channelsTable.setEditable(false); if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) { channelsTable.setHighlighters(HighlighterFactory.createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR, UIConstants.BACKGROUND_COLOR)); } channelsPanel.add(new JScrollPane(channelsTable), "grow"); add(channelsPanel, "newline, grow, h 40%"); }
From source file:TableDialogEditDemo.java
public Component getTableCellRendererComponent(JTable table, Object color, boolean isSelected, boolean hasFocus, int row, int column) { Color newColor = (Color) color; setBackground(newColor);/*from w w w .j a v a2 s. c o m*/ if (isBordered) { if (isSelected) { if (selectedBorder == null) { selectedBorder = BorderFactory.createMatteBorder(2, 5, 2, 5, table.getSelectionBackground()); } setBorder(selectedBorder); } else { if (unselectedBorder == null) { unselectedBorder = BorderFactory.createMatteBorder(2, 5, 2, 5, table.getBackground()); } setBorder(unselectedBorder); } } setToolTipText("RGB value: " + newColor.getRed() + ", " + newColor.getGreen() + ", " + newColor.getBlue()); return this; }
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 ww.j a v a 2 s.c om*/ 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(); } }); }