List of usage examples for javax.swing JPanel setBackground
@BeanProperty(preferred = true, visualUpdate = true, description = "The background color of the component.") public void setBackground(Color bg)
From source file:org.kepler.gui.ComponentLibraryPreferencesTab.java
/** * Initialize the top panel that contains controls for the table. *//*from w w w .ja v a 2 s . c om*/ private void initDoc() { String header = StaticResources.getDisplayString("preferences.description1", "The Component Library is built using KAR files found" + " in the following local directories. Adding or removing local directories will rebuild" + " the component library.") + "\n\n" + StaticResources.getDisplayString("preferences.description2", "By selecting the search box next to remote" + " repositories, components from the remote repositories will be included" + " when searching components.") + "\n\n" + StaticResources.getDisplayString("preferences.description3", "By selecting the save box next to a local repository, KAR files will be saved" + " to that directory by default.") + "\n\n" + StaticResources.getDisplayString("preferences.description4", "By selecting the save box next to a remote repository, you will be asked " + " if you want to upload the KAR to that repository when it is saved."); JTextArea headerTextArea = new JTextArea(header); headerTextArea.setEditable(false); headerTextArea.setLineWrap(true); headerTextArea.setWrapStyleWord(true); headerTextArea.setPreferredSize(new Dimension(300, 400)); headerTextArea.setBackground(TabManager.BGCOLOR); JPanel headerPanel = new JPanel(new BorderLayout()); headerPanel.setBackground(TabManager.BGCOLOR); headerPanel.add(headerTextArea, BorderLayout.CENTER); JScrollPane headerPane = new JScrollPane(headerPanel); headerPane.setPreferredSize(new Dimension(300, 150)); add(headerPane); }
From source file:org.kepler.gui.WorkflowOutlinePanel.java
private void setControls() { JPanel controlPanel = new JPanel(new BorderLayout()); if (includePortsCheckBox) { togglePorts = new JCheckBox(StaticResources.getDisplayString("outline.showPorts", "Show Ports")); togglePorts.setSelected(wotm.includePorts); togglePorts.addActionListener(new ToggleListener()); togglePorts.setBackground(TabManager.BGCOLOR); controlPanel.add(togglePorts, BorderLayout.NORTH); }/*from www.j av a 2 s . c om*/ if (includeAttributeCheckBox) { toggleAttributes = new JCheckBox( StaticResources.getDisplayString("outline.showAttributes", "Show Attributes")); toggleAttributes.setSelected(wotm.includeAttributes); toggleAttributes.addActionListener(new ToggleListener()); toggleAttributes.setBackground(TabManager.BGCOLOR); controlPanel.add(toggleAttributes, BorderLayout.CENTER); } if (includeRelationsCheckBox) { toggleRelations = new JCheckBox( StaticResources.getDisplayString("outline.showRelations", "Show Relations")); toggleRelations.setSelected(wotm.includeRelations); toggleRelations.addActionListener(new ToggleListener()); toggleRelations.setBackground(TabManager.BGCOLOR); controlPanel.add(toggleRelations, BorderLayout.SOUTH); } controlPanel.setBackground(TabManager.BGCOLOR); this.add(controlPanel, BorderLayout.SOUTH); }
From source file:org.multibit.viewsystem.swing.view.panels.ShowPreferencesPanel.java
private JPanel createButtonPanel() { JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); buttonPanel.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, SystemColor.windowBorder)); buttonPanel.setOpaque(true);/*ww w . j a v a 2 s . c o m*/ buttonPanel.setBackground(ColorAndFontConstants.MID_BACKGROUND_COLOR); buttonPanel.setComponentOrientation( ComponentOrientation.getOrientation(controller.getLocaliser().getLocale())); Action helpAction; if (ComponentOrientation.LEFT_TO_RIGHT == ComponentOrientation .getOrientation(controller.getLocaliser().getLocale())) { helpAction = new HelpContextAction(controller, ImageLoader.HELP_CONTENTS_BIG_ICON_FILE, "multiBitFrame.helpMenuText", "multiBitFrame.helpMenuTooltip", "multiBitFrame.helpMenuText", HelpContentsPanel.HELP_PREFERENCES_URL); } else { helpAction = new HelpContextAction(controller, ImageLoader.HELP_CONTENTS_BIG_RTL_ICON_FILE, "multiBitFrame.helpMenuText", "multiBitFrame.helpMenuTooltip", "multiBitFrame.helpMenuText", HelpContentsPanel.HELP_PREFERENCES_URL); } HelpButton helpButton = new HelpButton(helpAction, controller); helpButton.setText(""); helpButton.setToolTipText(controller.getLocaliser().getString("multiBitFrame.helpMenuTooltip")); helpButton.setHorizontalAlignment(SwingConstants.LEADING); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.gridx = 0; constraints.gridy = 0; constraints.weightx = 0.3; constraints.weighty = 0.1; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.anchor = GridBagConstraints.LINE_START; buttonPanel.add(helpButton, constraints); ShowPreferencesSubmitAction submitAction = new ShowPreferencesSubmitAction(this.bitcoinController, this.exchangeController, this, ImageLoader.createImageIcon(ImageLoader.PREFERENCES_ICON_FILE), mainFrame); MultiBitButton submitButton = new MultiBitButton(submitAction, controller); buttonPanel.add(submitButton); UndoPreferencesChangesSubmitAction undoChangesAction = new UndoPreferencesChangesSubmitAction(controller, ImageLoader.createImageIcon(ImageLoader.UNDO_ICON_FILE)); undoChangesButton = new MultiBitButton(undoChangesAction, controller); buttonPanel.add(undoChangesButton); constraints.fill = GridBagConstraints.NONE; constraints.gridx = 1; constraints.gridy = 0; constraints.weightx = 0.1; constraints.weighty = 1.0; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.anchor = GridBagConstraints.LINE_START; buttonPanel.add(submitButton, constraints); constraints.fill = GridBagConstraints.NONE; constraints.gridx = 2; constraints.gridy = 0; constraints.weightx = 0.1; constraints.weighty = 1.0; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.anchor = GridBagConstraints.LINE_START; buttonPanel.add(undoChangesButton, constraints); JPanel fill1 = new JPanel(); fill1.setOpaque(false); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.gridx = 2; constraints.gridy = 0; constraints.weightx = 200; constraints.weighty = 1; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.anchor = GridBagConstraints.LINE_END; buttonPanel.add(fill1, constraints); return buttonPanel; }
From source file:org.n52.ifgicopter.spf.gui.FrameworkCorePanel.java
/** * default constructor to create the framework core panel. */// w w w. j a va 2 s.c om public FrameworkCorePanel() { /* * INPUT PLUGIN LIST */ this.pluginsPanel = new JPanel(); this.pluginsPanel.setLayout(new GridBagLayout()); this.pluginsPanel.setBackground(DEFAULT_COLOR); this.globalGBC = new GridBagConstraints(); this.globalGBC.gridx = 0; this.globalGBC.gridy = 0; this.globalGBC.weightx = 0.0; this.globalGBC.weighty = 0.0; this.globalGBC.anchor = GridBagConstraints.NORTHWEST; this.globalGBC.fill = GridBagConstraints.HORIZONTAL; this.pluginsPanel.add( new JLabel("<html><body><div><strong>" + "Active Plugins</strong></div></body></html>"), this.globalGBC); this.globalGBC.gridy++; this.globalGBC.gridwidth = GridBagConstraints.REMAINDER; this.globalGBC.insets = new Insets(0, 0, 5, 0); this.pluginsPanel.add(new JSeparator(), this.globalGBC); this.globalGBC.insets = new Insets(0, 0, 0, 0); this.globalGBC.weightx = 1.0; this.globalGBC.gridy = 0; this.globalGBC.gridx = 1; this.pluginsPanel.add(Box.createHorizontalGlue(), this.globalGBC); this.globalGBC.weightx = 0.0; this.globalGBC.gridx = 0; this.globalGBC.gridy = 1; /* * the contentpanel */ this.contentPanel = new JPanel(); this.contentPanel.setLayout(new CardLayout()); this.contentPanel.setBorder(BorderFactory.createEtchedBorder()); this.contentPanel.add(WelcomePanel.getInstance(), WELCOME_PANEL); // ((CardLayout) contentPanel.getLayout()).show(contentPanel, WELCOME_PANEL); JScrollPane startupS = new JScrollPane(this.contentPanel); startupS.setViewportBorder(null); /* * wrap the plugins to ensure top alignment */ JPanel pluginsPanelWrapper = new JPanel(new BorderLayout()); pluginsPanelWrapper.add(this.pluginsPanel, BorderLayout.NORTH); pluginsPanelWrapper.add(Box.createVerticalGlue(), BorderLayout.CENTER); pluginsPanelWrapper.setBorder(BorderFactory.createEtchedBorder()); pluginsPanelWrapper.setBackground(this.pluginsPanel.getBackground()); JScrollPane wrapperS = new JScrollPane(pluginsPanelWrapper); wrapperS.setViewportBorder(null); /* * add both scroll panes to the split pane */ JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, wrapperS, startupS); splitPane.setOneTouchExpandable(true); splitPane.setDividerLocation(250); splitPane.setContinuousLayout(true); Dimension minimumSize = new Dimension(100, 100); startupS.setMinimumSize(minimumSize); this.setLayout(new BorderLayout()); this.add(splitPane); }
From source file:org.neo4j.desktop.ui.Components.java
static JPanel withBackground(Color color, JPanel panel) { panel.setBackground(color); return panel; }
From source file:org.nuclos.client.dbtransfer.DBTransferImport.java
private PanelWizardStep newStep1(final MainFrameTab ifrm) { final SpringLocaleDelegate localeDelegate = getSpringLocaleDelegate(); final PanelWizardStep step = new PanelWizardStep( localeDelegate.getMessage("dbtransfer.import.step1.1", "Konfigurationsdatei"), localeDelegate.getMessage("dbtransfer.import.step1.2", "Bitte w\u00e4hlen Sie eine Konfigurationsdatei aus.")); final JLabel lbFile = new JLabel(localeDelegate.getMessage("dbtransfer.import.step1.3", "Datei")); utils.initJPanel(step,//w ww. j a v a2 s .co m new double[] { TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.FILL }, new double[] { 20, TableLayout.PREFERRED, lbFile.getPreferredSize().height, TableLayout.FILL }); final JButton btnBrowse = new JButton("..."); //final JProgressBar progressBar = new JProgressBar(0, 230); final JCheckBox chbxImportAsNuclon = new JCheckBox( localeDelegate.getMessage("configuration.transfer.import.as.nuclon", "Import als Nuclon")); chbxImportAsNuclon.setEnabled(false); final JEditorPane editWarnings = new JEditorPane(); editWarnings.setContentType("text/html"); editWarnings.setEditable(false); editWarnings.setBackground(Color.WHITE); final JScrollPane scrollWarn = new JScrollPane(editWarnings); scrollWarn.setPreferredSize(new Dimension(680, 250)); scrollWarn.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); scrollWarn.getVerticalScrollBar().setUnitIncrement(20); scrollWarn.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollWarn.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); final JScrollPane scrollPrev = new JScrollPane(jpnPreviewContent); scrollPrev.setPreferredSize(new Dimension(680, 250)); scrollPrev.setBorder(new LineBorder(Color.LIGHT_GRAY, 1)); scrollPrev.getVerticalScrollBar().setUnitIncrement(20); scrollPrev.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPrev.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); final JPanel jpnPreview = new JPanel(new BorderLayout()); jpnPreview.add(jpnPreviewHeader, BorderLayout.NORTH); jpnPreview.add(scrollPrev, BorderLayout.CENTER); jpnPreview.add(jpnPreviewFooter, BorderLayout.SOUTH); jpnPreview.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); jpnPreview.setBackground(Color.WHITE); jpnPreviewHeader.setBackground(Color.WHITE); jpnPreviewContent.setBackground(Color.WHITE); jpnPreviewFooter.setBackground(Color.WHITE); final JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.addTab(localeDelegate.getMessage("configuration.transfer.prepare.warnings.tab", "Warnungen"), scrollWarn); final String sDefaultPreparePreviewTabText = localeDelegate .getMessage("configuration.transfer.prepare.preview.tab", "Vorschau der Schema Aenderungen"); tabbedPane.addTab(sDefaultPreparePreviewTabText, jpnPreview); final JLabel lbNewUser = new JLabel(); step.add(lbFile, "0,0"); step.add(tfTransferFile, "1,0"); step.add(btnBrowse, "2,0"); step.add(chbxImportAsNuclon, "1,1");//step.add(progressBar, "1,1"); step.add(lbNewUser, "0,2,3,2"); step.add(tabbedPane, "0,3,3,3"); tfTransferFile.setEditable(false); final ActionListener prepareImportAction = new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { ifrm.lockLayerWithProgress(Transfer.TOPIC_CORRELATIONID_PREPARE); Thread t = new Thread() { @Override public void run() { step.setComplete(false); boolean blnTransferWithWarnings = false; //progressBar.setValue(0); //progressBar.setVisible(true); try { String fileName = tfTransferFile.getText(); if (StringUtils.isNullOrEmpty(fileName)) { return; } File f = new File(fileName); long size = f.length(); final InputStream fin = new BufferedInputStream(new FileInputStream(f)); final byte[] transferFile; try { transferFile = utils.getBytes(fin, (int) size); } finally { fin.close(); } resetStep2(); importTransferObject = getTransferFacadeRemote().prepareTransfer(isNuclon, transferFile); chbxImportAsNuclon.setEnabled(importTransferObject.getTransferOptions() .containsKey(TransferOption.IS_NUCLON_IMPORT_ALLOWED)); step.setComplete(!importTransferObject.result.hasCriticals()); if (!importTransferObject.result.hasCriticals() && !importTransferObject.result.hasWarnings()) { editWarnings.setText(localeDelegate.getMessage( "configuration.transfer.prepare.no.warnings", "Keine Warnungen")); } else { editWarnings.setText("<html><body><font color=\"#800000\">" + importTransferObject.result.getCriticals() + "</font>" + (importTransferObject.result.hasCriticals() ? "<br />" : "") + importTransferObject.result.getWarnings() + "</body></html>"); } int iPreviewSize = importTransferObject.getPreviewParts().size(); blnTransferWithWarnings = setupPreviewPanel(importTransferObject.getPreviewParts()); tabbedPane.setTitleAt(1, sDefaultPreparePreviewTabText + (iPreviewSize == 0 ? "" : " (" + iPreviewSize + ")")); lbNewUser.setText( "Neue Benutzer" + ": " + (importTransferObject.getNewUserCount() == 0 ? "keine" : importTransferObject.getNewUserCount())); } catch (Exception e) { // progressBar.setVisible(false); Errors.getInstance().showExceptionDialog(ifrm, e); } finally { btnBrowse.setEnabled(true); // progressBar.setVisible(false); ifrm.unlockLayer(); } if (blnTransferWithWarnings) { JOptionPane.showMessageDialog(jpnPreviewContent, localeDelegate.getMessage( "dbtransfer.import.step1.19", "Nicht alle Statements knnen durchgefhrt werden!\nBitte kontrollieren Sie die mit rot markierten Eintrge!", "Warning", JOptionPane.WARNING_MESSAGE)); } } }; t.start(); } }; final ActionListener browseAction = new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { final JFileChooser filechooser = utils.getFileChooser( localeDelegate.getMessage("configuration.transfer.file.nuclet", "Nuclet-Dateien"), ".nuclet"); final int iBtn = filechooser.showOpenDialog(ifrm); if (iBtn == JFileChooser.APPROVE_OPTION) { final File file = filechooser.getSelectedFile(); if (file != null) { tfTransferFile.setText(""); btnBrowse.setEnabled(false); //progressBar.setVisible(true); String fileName = file.getPath(); if (StringUtils.isNullOrEmpty(fileName)) { return; } tfTransferFile.setText(fileName); prepareImportAction.actionPerformed(new ActionEvent(this, 0, "prepare")); } } } }; final ActionListener importAsNuclonAction = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { isNuclon = chbxImportAsNuclon.isSelected(); prepareImportAction.actionPerformed(new ActionEvent(this, 0, "prepare")); } }; btnBrowse.addActionListener(browseAction); chbxImportAsNuclon.addActionListener(importAsNuclonAction); // progressBar.setVisible(false); return step; }
From source file:org.nuclos.client.layout.wysiwyg.component.properties.PropertiesPanel.java
/** * The Label for the {@link PropertyValue} (left side of the Table) * @param value//from w w w . ja v a2 s. com * @return */ public static Component getCellComponent(String value) { JPanel result = new JPanel(); result.setOpaque(true); result.setBackground(Color.WHITE); TableLayout layout = new TableLayout( new double[][] { { InterfaceGuidelines.CELL_MARGIN_LEFT, TableLayout.FILL }, { InterfaceGuidelines.CELL_MARGIN_TOP, TableLayout.PREFERRED } }); result.setLayout(layout); result.add(new JLabel(value), new TableLayoutConstraints(1, 1)); return result; }
From source file:org.nuxeo.launcher.gui.NuxeoFrame.java
protected Component buildSummaryPanel() { JPanel summaryPanel = new JPanel(); summaryPanel.setLayout(new BoxLayout(summaryPanel, BoxLayout.PAGE_AXIS)); summaryPanel.setBackground(new Color(35, 37, 59)); summaryPanel.setForeground(Color.WHITE); summaryPanel.add(/* w ww . jav a 2s.c o m*/ new JLabel("<html><font color=#ffffdd>" + NuxeoLauncherGUI.getMessage("summary.status.label"))); summaryStatus = new JLabel(controller.launcher.status()); summaryStatus.setForeground(Color.WHITE); summaryPanel.add(summaryStatus); summaryPanel .add(new JLabel("<html><font color=#ffffdd>" + NuxeoLauncherGUI.getMessage("summary.url.label"))); summaryURL = new JLabel(controller.launcher.getURL()); summaryURL.setForeground(Color.WHITE); summaryPanel.add(summaryURL); errorMessageLabel = new JLabel(); errorMessageLabel.setForeground(Color.RED); summaryPanel.add(errorMessageLabel); summaryPanel.add(new JSeparator()); ConfigurationGenerator config = controller.launcher.getConfigurationGenerator(); summaryPanel.add( new JLabel("<html><font color=#ffffdd>" + NuxeoLauncherGUI.getMessage("summary.homedir.label"))); summaryPanel.add(new JLabel("<html><font color=white>" + config.getNuxeoHome().getPath())); summaryPanel.add( new JLabel("<html><font color=#ffffdd>" + NuxeoLauncherGUI.getMessage("summary.nuxeoconf.label"))); summaryPanel.add(new JLabel("<html><font color=white>" + config.getNuxeoConf().getPath())); summaryPanel.add( new JLabel("<html><font color=#ffffdd>" + NuxeoLauncherGUI.getMessage("summary.datadir.label"))); summaryPanel.add(new JLabel("<html><font color=white>" + config.getDataDir().getPath())); return summaryPanel; }
From source file:org.o3project.optsdn.don.frame.NeFrame.java
/** * Create a NE frame panel./*w w w . j a v a 2 s . c o m*/ * * @return The NE frame panel */ private JPanel createNePanel() { JPanel nePanel = new JPanel(); nePanel.setBackground(Color.WHITE); nePanel.setLayout(new BorderLayout()); JPanel centerPanel = new JPanel(); centerPanel.setLayout(new BoxLayout(centerPanel, BoxLayout.Y_AXIS)); centerPanel.add(createDrawingNePane()); centerPanel.add(createOmsConnectionInfoPane()); centerPanel.add(createInformationModelIdListPane(portList)); nePanel.add(centerPanel, BorderLayout.CENTER); nePanel.add(createConnectButtonPanel(), BorderLayout.SOUTH); return nePanel; }
From source file:org.o3project.optsdn.don.frame.NeFrame.java
/** * Create a panel that displays Flowmod message. * /*www . jav a2 s . co m*/ * @return The panel that displays Flowmod message */ private JPanel createFlowmodStatusPanel() { JPanel flowmodStatusPanel = new JPanel(); flowmodStatusPanel.setBackground(Color.WHITE); // Set maximum text size for the Flowmod message flowmodStatusLabel .setText("[match] in_port=65509, odu_sigtype=11, odu_sigid={TPN=1, tslen=8, tsmap=11111111}\n" + "[actions] output=65509, odu_sigtype=11, odu_sigid={TPN=1, tslen=8, tsmap=11111111}"); flowmodStatusPanel.add(flowmodStatusLabel); flowmodStatusPanel.setPreferredSize(flowmodStatusPanel.getPreferredSize()); // Set default text for the Flowmod message flowmodStatusLabel.setText(Constants.FLOWMOD_INFO_TEXT_DEFAULT); return flowmodStatusPanel; }