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:net.sf.mzmine.modules.visualization.ida.IDABottomPanel.java
IDABottomPanel(IDAVisualizerWindow masterFrame, RawDataFile dataFile, ParameterSet parameters) { this.dataFile = dataFile; this.masterFrame = masterFrame; setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); setBackground(Color.white);//from w ww .java 2 s . c o m setBorder(new EmptyBorder(5, 5, 5, 0)); add(Box.createHorizontalGlue()); GUIUtils.addLabel(this, "Show: ", SwingConstants.RIGHT); thresholdCombo = new JComboBox<Object>(PeakThresholdMode.values()); thresholdCombo.setSelectedItem(PeakThresholdMode.NONE); thresholdCombo.setBackground(Color.white); thresholdCombo.setFont(smallFont); thresholdCombo.addActionListener(this); add(thresholdCombo); JPanel peakThresholdPanel = new JPanel(); peakThresholdPanel.setBackground(Color.white); peakThresholdPanel.setLayout(new BoxLayout(peakThresholdPanel, BoxLayout.X_AXIS)); GUIUtils.addLabel(peakThresholdPanel, "Value: ", SwingConstants.RIGHT); peakTextField = new JTextField(); peakTextField.setPreferredSize(new Dimension(50, 15)); peakTextField.setFont(smallFont); peakTextField.addActionListener(this); peakThresholdPanel.add(peakTextField); add(peakThresholdPanel); GUIUtils.addLabel(this, " from peak list: ", SwingConstants.RIGHT); peakListSelector = new JComboBox<PeakList>(); peakListSelector.setBackground(Color.white); peakListSelector.setFont(smallFont); peakListSelector.addActionListener(masterFrame); peakListSelector.setActionCommand("PEAKLIST_CHANGE"); add(peakListSelector); thresholdSettings = parameters.getParameter(IDAParameters.peakThresholdSettings); thresholdCombo.setSelectedItem(thresholdSettings.getMode()); add(Box.createHorizontalStrut(10)); add(Box.createHorizontalGlue()); }
From source file:net.sf.mzmine.modules.visualization.msms.MsMsBottomPanel.java
MsMsBottomPanel(MsMsVisualizerWindow masterFrame, RawDataFile dataFile, ParameterSet parameters) { this.dataFile = dataFile; this.masterFrame = masterFrame; setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); setBackground(Color.white);/* w ww. j a va2 s . com*/ setBorder(new EmptyBorder(5, 5, 5, 0)); add(Box.createHorizontalGlue()); GUIUtils.addLabel(this, "Show: ", SwingConstants.RIGHT); thresholdCombo = new JComboBox<Object>(PeakThresholdMode.values()); thresholdCombo.setSelectedItem(PeakThresholdMode.NONE); thresholdCombo.setBackground(Color.white); thresholdCombo.setFont(smallFont); thresholdCombo.addActionListener(this); add(thresholdCombo); JPanel peakThresholdPanel = new JPanel(); peakThresholdPanel.setBackground(Color.white); peakThresholdPanel.setLayout(new BoxLayout(peakThresholdPanel, BoxLayout.X_AXIS)); GUIUtils.addLabel(peakThresholdPanel, "Value: ", SwingConstants.RIGHT); peakTextField = new JTextField(); peakTextField.setPreferredSize(new Dimension(50, 15)); peakTextField.setFont(smallFont); peakTextField.addActionListener(this); peakThresholdPanel.add(peakTextField); add(peakThresholdPanel); GUIUtils.addLabel(this, " from peak list: ", SwingConstants.RIGHT); peakListSelector = new JComboBox<PeakList>(); peakListSelector.setBackground(Color.white); peakListSelector.setFont(smallFont); peakListSelector.addActionListener(masterFrame); peakListSelector.setActionCommand("PEAKLIST_CHANGE"); add(peakListSelector); thresholdSettings = parameters.getParameter(MsMsParameters.peakThresholdSettings); thresholdCombo.setSelectedItem(thresholdSettings.getMode()); add(Box.createHorizontalStrut(10)); add(Box.createHorizontalGlue()); }
From source file:es.emergya.ui.plugins.LayerSelectionDialog.java
public LayerSelectionDialog(CustomMapView gmv) { super();/*from w w w. ja v a 2 s . com*/ self = this; this.setTitle("Otras Capas"); actualizando = new JLabel(LogicConstants.getIcon("anim_actualizando")); this.setAlwaysOnTop(true); this.mv = gmv; this.layers = new ArrayList<LayerElement>(); try { setIconImage(((BasicWindow) GoClassLoader.getGoClassLoader().load(BasicWindow.class)).getIconImage()); } catch (Throwable e1) { LOG.error("Couldn't find icon image", e1); } JPanel base = new JPanel(); base.setPreferredSize(new Dimension(240, 150)); base.setBackground(Color.WHITE); base.setLayout(new BoxLayout(base, BoxLayout.Y_AXIS)); base.add(new JLabel(i18n.getString("map.layers.avaliable"))); list = new JPanel(); list.setLayout(new BoxLayout(list, BoxLayout.Y_AXIS)); list.add(actualizando); list.setBackground(Color.WHITE); // list.setPreferredSize(new Dimension(100, 100)); final JScrollPane scrollPane = new JScrollPane(list); scrollPane.setBackground(Color.WHITE); base.add(scrollPane); mv.addComponentListener(new ComponentAdapter() { @Override public void componentShown(ComponentEvent e) { } }); add(base); pack(); }
From source file:MenuItemChooser.java
private void initGUI() { JPanel itemDetailsPanel = new JPanel(); itemDetailsPanel.setLayout(new GridLayout(4, 2)); itemDetailsPanel.setBackground(Color.WHITE); JLabel lbl = new JLabel("Item: "); itemDetailsPanel.add(lbl);// w w w. j ava 2 s .c o m itemName = new JLabel(""); itemDetailsPanel.add(itemName); lbl = new JLabel("Type: "); itemDetailsPanel.add(lbl); itemType = new JLabel(""); itemDetailsPanel.add(itemType); lbl = new JLabel("Price: $ "); itemDetailsPanel.add(lbl); price = new JLabel(""); itemDetailsPanel.add(price); lbl = new JLabel("Quantity: "); itemDetailsPanel.add(lbl); qty = new JTextField("0", 1); qty.addActionListener(this); qty.addFocusListener(this); itemDetailsPanel.add(qty); JPanel imgDescPanel = new JPanel(new BorderLayout()); imgDescPanel.setBackground(Color.WHITE); image = new JLabel(""); image.setHorizontalAlignment(SwingConstants.CENTER); image.setVerticalAlignment(SwingConstants.CENTER); imgDescPanel.add(image, BorderLayout.NORTH); desc = new JLabel("desc"); imgDescPanel.add(desc, BorderLayout.SOUTH); JPanel buttonPanel = new JPanel(); buttonPanel.setBackground(Color.WHITE); next = new JButton("Next"); next.addActionListener(this); buttonPanel.add(next); prev = new JButton("Previous"); prev.addActionListener(this); buttonPanel.add(prev); order = new JButton("Order"); order.addActionListener(this); buttonPanel.add(order); cancel = new JButton("Cancel / New"); cancel.addActionListener(this); buttonPanel.add(cancel); close = new JButton("Close"); close.addActionListener(this); close.setEnabled(false); buttonPanel.add(close); totalLbl = new JLabel(""); totalLbl.setFont(new Font("Serif", Font.BOLD, 14)); totalLbl.setForeground((Color.GREEN).darker()); buttonPanel.add(totalLbl); BorderLayout bl = new BorderLayout(); bl.setHgap(30); bl.setVgap(20); setLayout(bl); setBackground(Color.WHITE); add(itemDetailsPanel, BorderLayout.WEST); add(imgDescPanel, BorderLayout.EAST); add(buttonPanel, BorderLayout.SOUTH); TitledBorder title = BorderFactory.createTitledBorder("Choose Menu Items And Place Order"); setBorder(title); loadMenuItem(); }
From source file:com.devoteam.srit.xmlloader.core.report.derived.StatCount.java
@Override public JPanel generateLongRTStats() { // Panel we will return with all information of this counter JPanel panel = new JPanel(); // Layout for this panel panel.setLayout(new javax.swing.BoxLayout(panel, javax.swing.BoxLayout.Y_AXIS)); // Color of background for this panel panel.setBackground(new java.awt.Color(248, 248, 248)); // We add as a Tooltip the long description of this counter panel.setToolTipText(template.complete); // We add this html code as a JLabel in the panel panel.add(new JLabel(generateLongStringHTML())); // We return the panel return panel; }
From source file:com.documentgenerator.view.MainWindow.java
private void initComponents() { statusBarPanel = new StatusBarPanel(); //JPanel northPanel = new ImagePanel(new FlowLayout(), windowUtils.getImageIcon("images/header.gif").getImage()); JPanel centerPanel = new JPanel(); JPanel southPanel = new JPanel(new FlowLayout()); centerPanel.setLayout(new BorderLayout()); centerPanel.setBackground(Color.WHITE); //adding components mdlFunctions.setJTabbedPane(tabbedPane); tabbedPane.addTab("Configuration", WindowUtils.getImageIcon("images/ListBarrowers.gif"), new ConfigPanel(this), "Configuration"); tabbedPane.addTab("Name Entry", WindowUtils.getImageIcon("images/ListBarrowers.gif"), new NameEntryConfigPanel(this), "Name Entry"); tabbedPane.addTab("Schedule Entry", WindowUtils.getImageIcon("images/ListBarrowers.gif"), new ScheduleEntryConfigPanel(this), "Schedule Entry"); tabbedPane.addTab("Document Details", WindowUtils.getImageIcon("images/ListBarrowers.gif"), new DocumentEntryConfigPanel(this), "Document Details"); //northPanel.add(lblIcon); //northPanel.add(lblCaption); centerPanel.add(tabbedPane);//from w w w .j a v a 2 s . c o m southPanel.setBackground(Color.WHITE); southPanel.add(statusBarPanel); setLayout(new BorderLayout()); setBackground(Color.WHITE); //add(northPanel, BorderLayout.PAGE_START); add(centerPanel, BorderLayout.CENTER); add(southPanel, BorderLayout.SOUTH); menuBar = new JMenuBar(); container = getContentPane(); setJMenuBar(menuBar); }
From source file:com.hp.alm.ali.idea.content.settings.SettingsPanel.java
public SettingsPanel(final Project prj, Color bgColor) { this.prj = prj; this.projectConf = prj.getComponent(AliProjectConfiguration.class); previewAndConnection = new JPanel(new GridBagLayout()); previewAndConnection.setOpaque(false); GridBagConstraints c2 = new GridBagConstraints(); c2.gridx = 0;/*from w ww. ja va2 s . c o m*/ c2.gridy = 1; c2.gridwidth = 2; c2.weighty = 1; c2.fill = GridBagConstraints.VERTICAL; JPanel filler = new JPanel(); filler.setOpaque(false); previewAndConnection.add(filler, c2); passwordPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); passwordPanel.setBackground(bgColor); JLabel label = new JLabel("Password"); label.setFont(label.getFont().deriveFont(Font.BOLD)); passwordPanel.add(label); final JPasswordField password = new JPasswordField(24); passwordPanel.add(password); JButton connect = new JButton("Login"); passwordPanel.add(connect); final JLabel message = new JLabel(); passwordPanel.add(message); ActionListener connectionAction = new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { try { checkConnection(projectConf.getLocation(), projectConf.getDomain(), projectConf.getProject(), projectConf.getUsername(), password.getText()); } catch (AuthenticationFailed e) { message.setText(e.getMessage()); return; } projectConf.ALM_PASSWORD = password.getText(); projectConf.fireChanged(); } }; password.addActionListener(connectionAction); connect.addActionListener(connectionAction); restService = prj.getComponent(RestService.class); restService.addServerTypeListener(this); location = createTextPane(bgColor); domain = createTextPane(bgColor); project = createTextPane(bgColor); username = createTextPane(bgColor); final JPanel panel = new JPanel(new BorderLayout()); panel.setBackground(bgColor); panel.setBorder(new EmptyBorder(10, 10, 10, 10)); final JTextPane textPane = new JTextPane(); textPane.setEditorKit(new HTMLEditorKit()); textPane.setText( "<html><body>HP ALM integration can be configured on <a href=\"ide\">IDE</a> and overridden on <a href=\"project\">project</a> level.</body></html>"); textPane.setEditable(false); textPane.addHyperlinkListener(this); textPane.setBackground(bgColor); textPane.setCaret(new NonAdjustingCaret()); panel.add(textPane, BorderLayout.CENTER); JPanel content = new JPanel(new BorderLayout()); content.setBackground(bgColor); content.add(panel, BorderLayout.NORTH); content.add(previewAndConnection, BorderLayout.WEST); preview = new JPanel(new GridBagLayout()) { public Dimension getPreferredSize() { Dimension dim = super.getPreferredSize(); // make enough room for the connection status message dim.width = Math.max(dim.width, 300); return dim; } public Dimension getMinimumSize() { return getPreferredSize(); } }; connectedTo(restService.getServerTypeIfAvailable()); preview.setBackground(bgColor); final GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1; c.gridx = 0; c.gridy = 0; c.gridwidth = 2; c.anchor = GridBagConstraints.WEST; preview.add(location, c); c.gridwidth = 1; c.gridy++; preview.add(domain, c); c.gridy++; preview.add(project, c); c.gridy++; preview.add(username, c); c.gridx++; c.gridy--; c.gridheight = 2; c.weightx = 0; c.anchor = GridBagConstraints.SOUTHEAST; final LinkLabel reload = new LinkLabel("Reload", IconLoader.getIcon("/actions/sync.png")); reload.setListener(new LinkListener() { public void linkSelected(LinkLabel linkLabel, Object o) { projectConf.fireChanged(); } }, null); preview.add(reload, c); JPanel previewNorth = new JPanel(new BorderLayout()); previewNorth.setBackground(bgColor); previewNorth.add(preview, BorderLayout.NORTH); addToGridBagPanel(0, 0, previewAndConnection, previewNorth); setBackground(bgColor); setLayout(new BorderLayout()); add(content, BorderLayout.CENTER); onChanged(); ApplicationManager.getApplication().getComponent(AliConfiguration.class).addListener(this); projectConf.addListener(this); }
From source file:cn.edu.tsinghua.gui.HistogramDemo.java
/** * Initialize display.//from w w w . ja va 2 s. c o m * @author Sun Microsystems * @param filename is the image filename */ public HistogramDemo(String filename) { File f = new File(filename); if (f.exists() && f.canRead()) { source = JAI.create("fileload", filename); } else { return; } canvas = new ImageDisplay(source); canvas.setLayout(new FlowLayout(FlowLayout.RIGHT, 2, 2)); panner = new Panner(canvas, source, 128); panner.setBackground(Color.red); panner.setBorder(new EtchedBorder()); canvas.add(panner); Font font = new Font("SansSerif", Font.BOLD, 12); JLabel title = new JLabel(" Histogram"); title.setFont(font); title.setLocation(0, 32); setOpaque(true); setLayout(new BorderLayout()); setBackground(Color.white); graph = new XYPlot(); graph.setBackground(Color.black); graph.setBorder(new LineBorder(new Color(0, 0, 255), 1)); Colorbar cbar = new Colorbar(); cbar.setBackground(Color.black); cbar.setPreferredSize(new Dimension(256, 25)); cbar.setBorder(new LineBorder(new Color(255, 0, 255), 2)); JPanel hist_panel = new JPanel(); hist_panel.setLayout(new BorderLayout()); hist_panel.setBackground(Color.white); hist_panel.add(graph, BorderLayout.CENTER); hist_panel.add(cbar, BorderLayout.SOUTH); JPanel panel = new JPanel(); panel.setLayout(new GridLayout(2, 1, 5, 5)); panel.setBackground(Color.white); panel.add(canvas); panel.add(hist_panel); JPanel controlPanel = new JPanel(); controlPanel.setLayout(new FlowLayout()); reset = new JButton("Reset"); equal = new JButton("Uniform"); norm = new JButton("Gaussian"); piece = new JButton("Piecewise"); reset.addActionListener(this); equal.addActionListener(this); norm.addActionListener(this); piece.addActionListener(this); controlPanel.add(reset); controlPanel.add(equal); controlPanel.add(norm); controlPanel.add(piece); add(title, BorderLayout.NORTH); add(panel, BorderLayout.CENTER); add(controlPanel, BorderLayout.SOUTH); // original histogram (remains unmodified) // graph.plot( getHistogram(source) ); graph.plot(getMultiHistogram(source)); }
From source file:com.willwinder.universalgcodesender.uielements.panels.MachineStatusPanel.java
private void initComponents() { // Hookup the reset buttons. resetXButton.addActionListener(ae -> resetCoordinateButton('X')); resetYButton.addActionListener(ae -> resetCoordinateButton('Y')); resetZButton.addActionListener(ae -> resetCoordinateButton('Z')); String debug = ""; //String debug = "debug, "; // MigLayout... 3rd party layout library. MigLayout layout = new MigLayout(debug + "fill, wrap 2"); setLayout(layout);/*w ww . j a v a 2 s. co m*/ add(activeStateLabel, "al right"); add(activeStateValueLabel); add(latestCommentLabel, "al right"); add(latestCommentValueLabel); // Subpanels for work/machine read outs. JPanel workPanel = new JPanel(); workPanel.setBackground(Color.LIGHT_GRAY); workPanel.setLayout(new MigLayout(debug + "fillx, wrap 3, inset 8", "[left][right][grow, right]")); //workPanel.add(workPositionLabel, "span 2, wrap"); workPanel.add(resetXButton); workPanel.add(workPositionXLabel, "al right"); workPanel.add(workPositionXValue, "growx, bottom"); workPanel.add(machinePositionXValue, "span 3, al right, wrap"); workPanel.add(resetYButton); workPanel.add(workPositionYLabel, "al right"); workPanel.add(workPositionYValue, "growx, bottom"); workPanel.add(machinePositionYValue, "span 3, al right, wrap"); workPanel.add(resetZButton); workPanel.add(workPositionZLabel, "al right"); workPanel.add(workPositionZValue, "growx, bottom"); workPanel.add(machinePositionZValue, "span 3, al right, wrap"); add(workPanel, "growx, span 2"); // Enabled pin reporting. pinStatusPanel.setLayout(new MigLayout("flowy, wrap 3")); pinStatusPanel.add(pinX); pinX.setEnabled(false); pinStatusPanel.add(pinY); pinY.setEnabled(false); pinStatusPanel.add(pinZ); pinZ.setEnabled(false); pinStatusPanel.add(pinProbe); pinProbe.setEnabled(false); pinStatusPanel.add(pinDoor); pinDoor.setEnabled(false); pinStatusPanel.add(pinHold); pinHold.setEnabled(false); pinStatusPanel.add(pinSoftReset); pinSoftReset.setEnabled(false); pinStatusPanel.add(pinCycleStart); pinCycleStart.setEnabled(false); }
From source file:es.emergya.ui.gis.popups.GPSDialog.java
public GPSDialog(Recurso r) { super();/* w w w. ja v a 2s .co m*/ setAlwaysOnTop(true); setResizable(false); iconTransparente = LogicConstants.getIcon("48x48_transparente"); iconEnviando = LogicConstants.getIcon("anim_actualizando"); target = r; setDefaultCloseOperation(DISPOSE_ON_CLOSE); setPreferredSize(new Dimension(400, 150)); setTitle(i18n.getString("window.gps.titleBar") + " " + target.getIdentificador()); try { setIconImage(((BasicWindow) GoClassLoader.getGoClassLoader().load(BasicWindow.class)).getFrame() .getIconImage()); } catch (Throwable e) { LOG.error("There is no icon image", e); } JPanel base = new JPanel(); base.setBackground(Color.WHITE); base.setLayout(new BoxLayout(base, BoxLayout.Y_AXIS)); // Icono del titulo JPanel title = new JPanel(new FlowLayout(FlowLayout.LEADING)); final JLabel titleLabel = new JLabel(i18n.getString("window.gps.title"), LogicConstants.getIcon("tittleventana_icon_actualizargps"), JLabel.LEFT); titleLabel.setFont(LogicConstants.deriveBoldFont(12f)); title.add(titleLabel); title.setOpaque(false); base.add(title); // Area para mensajes JPanel notificationArea = new JPanel(); notificationArea.setOpaque(false); notification = new JLabel("PLACEHOLDER"); notification.setForeground(Color.WHITE); notificationArea.add(notification); base.add(notificationArea); JPanel buttons = new JPanel(); buttons.setOpaque(false); buttons.setLayout(new BoxLayout(buttons, BoxLayout.X_AXIS)); actualizar = new JButton(i18n.getString("window.gps.button.actualizar"), LogicConstants.getIcon("ventanacontextual_button_solicitargps")); actualizar.addActionListener(this); buttons.add(actualizar); buttons.add(Box.createHorizontalGlue()); progressIcon = new JLabel(iconTransparente); buttons.add(progressIcon); buttons.add(Box.createHorizontalGlue()); JButton cancel = new JButton(i18n.getString("Buttons.cancel"), LogicConstants.getIcon("button_cancel")); cancel.addActionListener(this); buttons.add(cancel); base.add(buttons); getContentPane().add(base); pack(); int x; int y; Container myParent; try { myParent = ((BasicWindow) GoClassLoader.getGoClassLoader().load(BasicWindow.class)).getFrame() .getContentPane(); java.awt.Point topLeft = myParent.getLocationOnScreen(); Dimension parentSize = myParent.getSize(); Dimension mySize = getSize(); if (parentSize.width > mySize.width) x = ((parentSize.width - mySize.width) / 2) + topLeft.x; else x = topLeft.x; if (parentSize.height > mySize.height) y = ((parentSize.height - mySize.height) / 2) + topLeft.y; else y = topLeft.y; setLocation(x, y); } catch (Throwable e1) { LOG.error("There is no basic window!", e1); } this.addWindowListener(new WindowAdapter() { @Override public void windowOpened(WindowEvent arg0) { deleteErrorMessage(); } @Override public void windowClosed(WindowEvent arg0) { deleteErrorMessage(); } @Override public void windowClosing(WindowEvent arg0) { deleteErrorMessage(); } private void deleteErrorMessage() { SwingWorker<Object, Object> sw = new SwingWorker<Object, Object>() { @Override protected Object doInBackground() throws Exception { if (last_bandejaSalida != null) { MessageGenerator.remove(last_bandejaSalida.getId()); } return null; } @Override protected void done() { super.done(); GPSDialog.this.progressIcon.setIcon(iconTransparente); GPSDialog.this.progressIcon.repaint(); last_bandejaSalida = null; GPSDialog.this.notification.setText(""); GPSDialog.this.notification.repaint(); } }; sw.execute(); } }); }