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:com.antelink.sourcesquare.gui.view.ExitSourceSquareView.java
/** * Create the frame.//from ww w .j a v a 2 s. co m */ public ExitSourceSquareView() { setIconImage(Toolkit.getDefaultToolkit().getImage(SourceSquareView.class.getResource("/antelink.png"))); setTitle("SourceSquare"); setResizable(false); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 500, 170); this.contentPane = new JPanel(); this.contentPane.setBackground(Color.WHITE); this.contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(this.contentPane); this.mainPanel = new JPanel(); this.mainPanel.setBackground(Color.WHITE); GroupLayout gl_contentPane = new GroupLayout(this.contentPane); gl_contentPane.setHorizontalGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) .addComponent(this.mainPanel, GroupLayout.DEFAULT_SIZE, 428, Short.MAX_VALUE)); gl_contentPane.setVerticalGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) .addComponent(this.mainPanel, GroupLayout.DEFAULT_SIZE, 263, Short.MAX_VALUE)); this.mainPanel.setLayout(new BoxLayout(this.mainPanel, BoxLayout.Y_AXIS)); JPanel panel_1 = new JPanel(); panel_1.setBackground(Color.WHITE); this.mainPanel.add(panel_1); panel_1.setLayout(new BorderLayout(0, 0)); JPanel panel = new JPanel(); panel.setLayout(new FlowLayout(FlowLayout.CENTER, 50, 20)); panel.setBackground(Color.WHITE); panel_1.add(panel, BorderLayout.SOUTH); Image openButtonImage = Toolkit.getDefaultToolkit() .getImage(SourceSquareView.class.getResource("/OpenButton.png")); this.openButtonLabel = new JLabel(new ImageIcon(openButtonImage)); this.openButtonLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); panel.add(this.openButtonLabel); JLabel exitLabel = new JLabel("<html><b>Closing this window will quit the application</b></html>"); exitLabel.setFont(new Font("Helvetica", Font.PLAIN, 13)); JLabel explainLabel = new JLabel("<html>(You won't be able to see or publish your results anymore)</html>"); explainLabel.setFont(new Font("Helvetica", Font.PLAIN, 13)); JPanel textPanel = new JPanel(); textPanel.setBackground(Color.WHITE); textPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 0)); textPanel.add(exitLabel, BorderLayout.CENTER); textPanel.add(explainLabel, BorderLayout.CENTER); panel_1.add(textPanel, BorderLayout.CENTER); CopyrightPanel copyrightPanel = new CopyrightPanel(); copyrightPanel.setBackground(Color.WHITE); this.mainPanel.add(copyrightPanel); this.contentPane.setLayout(gl_contentPane); setLocationRelativeTo(null); }
From source file:org.jfree.chart.demo.LeftPanel.java
public LeftPanel(ArrayList<ChartPanel> graphics, ArrayList<Graphic> Grafs, ArrayList<JFreeChart> charts, ArrayList<XYSeries> Series) { //setBackground(new Color(152 ,134, 202)); //setBackground(new Color(234 ,247, 202)); setSize(800, 530);//ww w .j a v a2 s .co m setLayout(null); setBackground(new Color(176, 199, 246)); JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP); tabbedPane.setBackground(new Color(174, 250, 127)); tabbedPane.setFont(new Font("Arial", 15, 16)); tabbedPane.setOpaque(false); tabbedPane.setBounds(7, 6, 750, 505); tabbedPane.setAlignmentY(Component.TOP_ALIGNMENT); add(tabbedPane); JPanel panel = new JPanel(); panel.setBackground(new Color(176, 199, 246)); panel.setToolTipText("Graphic 1"); panel.add(graphics.get(0)); panel.add(new bottom_slider(new Color(176, 199, 246), charts, Grafs.get(0), 0)); tabbedPane.addTab("Graphic 1", null, panel, null); panel.setLayout(null); JPanel panel_2 = new JPanel(); panel_2.add(graphics.get(1)); tabbedPane.addTab("Graphic 2", null, panel_2, null); panel_2.setLayout(null); panel_2.setBackground(new Color(176, 199, 246)); panel_2.add(new bottom_slider(new Color(176, 199, 246), charts, Grafs.get(1), 1)); JPanel panel_1 = new JPanel(); panel_1.add(graphics.get(2)); tabbedPane.addTab("Graphic 3", null, panel_1, null); panel_1.setLayout(null); panel_1.setBackground(new Color(176, 199, 246)); panel_1.add(new bottom_slider(new Color(176, 199, 246), charts, Grafs.get(2), 2)); panel_1.setBackground(new Color(176, 199, 246)); JPanel panel_3 = new JPanel(); panel_3.add(graphics.get(3)); tabbedPane.addTab("Graphic 4", null, panel_3, null); panel_3.setLayout(null); panel_3.setBackground(new Color(176, 199, 246)); panel_3.add(new bottom_slider(new Color(176, 199, 246), charts, Grafs.get(3), 3)); JPanel panel_4 = new JPanel(); panel_4.add(graphics.get(4)); tabbedPane.addTab("Graphic 5 ", null, panel_4, null); panel_4.setLayout(null); panel_4.setBackground(new Color(176, 199, 246)); panel_4.add(new bottom_slider(new Color(176, 199, 246), charts, Grafs.get(4), 4)); JPanel panel_5 = new JPanel(); panel_5.add(graphics.get(5)); tabbedPane.addTab("Graphic 6", null, panel_5, null); panel_5.setLayout(null); panel_5.setBackground(new Color(176, 199, 246)); panel_5.add(new bottom_slider(new Color(176, 199, 246), charts, Grafs.get(5), 5)); JPanel panel_6 = new JPanel(); panel_6.add(graphics.get(6)); tabbedPane.addTab("Graphic 7", null, panel_6, null); panel_6.setLayout(null); panel_6.setBackground(new Color(176, 199, 246)); panel_6.add(new bottom_slider(new Color(176, 199, 246), charts, Grafs.get(6), 6)); JPanel panel_7 = new JPanel(); panel_7.add(graphics.get(7)); tabbedPane.addTab("Graphic 8", null, panel_7, null); panel_7.setLayout(null); panel_7.setBackground(new Color(176, 199, 246)); panel_7.add(new bottom_slider(new Color(176, 199, 246), charts, Grafs.get(7), 7)); JPanel panel_8 = new JPanel(); panel_8.add(new Bottom_panel(Grafs, Series, 5, 390, 735, 50)); graphics.set(8, Grafs.get(8).get_ChartPanel(740, 390)); panel_8.add(graphics.get(8)); tabbedPane.addTab("Graphic 9", null, panel_8, null); panel_8.setLayout(null); panel_8.setBackground(new Color(176, 199, 246)); JPanel panel_9 = new JPanel(); panel_9.add(graphics.get(9)); tabbedPane.addTab("Graphic 10", null, panel_9, null); panel_9.setLayout(null); panel_9.setBackground(new Color(176, 199, 246)); }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.UserDiskSpace.java
/** Builds and lays out the GUI. */ void buildGUI() { data.removeAll();/*w w w .j a v a 2 s .c o m*/ DiskQuota quota = view.isDiskSpaceLoaded(); if (quota != null) { DefaultPieDataset dataset = new DefaultPieDataset(); long free = quota.getAvailableSpace(); long used = quota.getUsedSpace(); if (free < 0 || used < 0) { buildChartNotAvailable(); return; } dataset.setValue("Free " + UIUtilities.formatFileSize(free), free); dataset.setValue("Used " + UIUtilities.formatFileSize(used), used); try { JFreeChart chart = ChartFactory.createPieChart3D("", dataset, false, true, false); PiePlot3D plot = (PiePlot3D) chart.getPlot(); plot.setDirection(Rotation.CLOCKWISE); plot.setForegroundAlpha(0.55f); data.add(new ChartPanel(chart), BorderLayout.CENTER); } catch (Exception e) { buildChartNotAvailable(); } } else { JXBusyLabel busyLabel = new JXBusyLabel(); busyLabel.setBackground(UIUtilities.BACKGROUND_COLOR); busyLabel.setEnabled(true); busyLabel.setBusy(true); JPanel p = UIUtilities.buildComponentPanelCenter(busyLabel); p.setBackground(UIUtilities.BACKGROUND_COLOR); data.add(p, BorderLayout.CENTER); } revalidate(); repaint(); }
From source file:com.aw.swing.mvp.grid.GridManager.java
private void configureGridTitleColor() { JPanel pnlGrid = ipView.getPnlGrid(gridIndex); pnlGrid.setBorder(BorderFactory.createLineBorder(new Color(131, 172, 219))); JPanel pnlTitGrid = ipView.getPnlTitGrid(gridIndex); pnlTitGrid.setBackground(new Color(131, 172, 219)); pnlTitGrid.setLayout(// w ww. j a v a 2 s .c o m new FormLayout("fill:16dlu:noGrow,left:4dlu:noGrow,fill:d:grow,left:4dlu:noGrow,right:pref:grow", "center:16dlu:noGrow")); JLabel lblTitGrid = ipView.getLblTitGrid(gridIndex); lblTitGrid.setFont(new Font(lblTitGrid.getFont().getName(), Font.BOLD, 14)); lblTitGrid.setForeground(Color.black); numRecords = new JLabel(""); numRecords.setFont(new Font(lblTitGrid.getFont().getName(), Font.BOLD, 14)); numRecords.setForeground(Color.black); numRecords.setVisible(showTotalRegistros); pnlTitGrid.remove(lblTitGrid); CellConstraints cc = new CellConstraints(); pnlTitGrid.add(lblTitGrid, cc.xy(3, 1)); pnlTitGrid.add(numRecords, cc.xy(5, 1)); }
From source file:com.aw.swing.mvp.view.ViewManager.java
/** * Setting some default colors to the screens *//*from w ww . java2 s . c o m*/ private void prepareView() { if (!(presenter instanceof FindPresenter)) { JPanel pnlToolBar = getIpView().getPnlToolBar(); if (pnlToolBar != null) { pnlToolBar.setBackground(new Color(223, 232, 246)); pnlToolBar.setBorder(BorderFactory.createLineBorder(new Color(131, 172, 219), 1)); } } }
From source file:jcine.CineForm.java
private void buildHall(Asiento[] asientos) { //Encontraremos las dimensiones de sala Integer maxX = 0;//from w ww . ja v a 2s . co m Integer maxY = 0; for (int i = 0; i < asientos.length; i++) { if (asientos[i].getPosX() > maxX) { maxX = asientos[i].getPosX(); } if (asientos[i].getPosY() > maxY) { maxY = asientos[i].getPosY(); } } //los tamaos de sillas Integer sizeX = pHall.getWidth() / maxX; Integer sizeY = pHall.getHeight() / maxY; Boolean[][] matrix = new Boolean[maxX][maxY]; //sillas for (int i = 0; i < asientos.length; i++) { JButton btn = new JButton("btn_" + Integer.toString(i)); btn.setText(asientos[i].getName()); btn.setLocation(sizeX * (asientos[i].getPosX() - 1), sizeY * (asientos[i].getPosY() - 1)); btn.setSize(sizeX - SPACER, sizeY - SPACER); btn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { chairPressed(evt); } }); matrix[asientos[i].getPosX() - 1][asientos[i].getPosY() - 1] = true; pHall.add(btn); } //pasillos for (int x = 0; x < maxX; x++) { for (int y = 0; y < maxY; y++) { if (matrix[x][y] == null) { JPanel panel = new JPanel(); panel.setBackground(Color.cyan); panel.setLocation(x * sizeX - SPACER, y * sizeY - SPACER); panel.setSize(sizeX + 2 * SPACER, sizeY + 2 * SPACER); pHall.add(panel); } } } pHall.repaint(); }
From source file:net.nosleep.superanalyzer.panels.HomePanel.java
public JPanel createHeaderPanel(JComboBox comboBox, boolean showTagWarning) { JPanel panel = new JPanel(new BorderLayout()); panel.setBackground(Color.WHITE); if (comboBox != null) { comboBox.setOpaque(false);//from w w w . j a v a2 s .c o m panel.add(comboBox, BorderLayout.WEST); } if (showTagWarning == true) panel.add(createWarningPanel(true), BorderLayout.EAST); return panel; }
From source file:com.polivoto.vistas.Editor.java
/** * Ventana Editor - configura el color de las preguntas. *//*ww w. java 2 s .co m*/ public Editor(JSONArray js) { initComponents(); for (int i = 0; i < js.length(); i++) { try { JPanel panel = new JPanel(new GridLayout(0, 2, 10, 10)); panel.setBackground(new Color(255, 255, 255)); jTabbedPane.add(panel, "Pregunta " + (i + 1)); JLabel lab1 = new JLabel( "Pregunta " + (i + 1) + ": " + ((JSONObject) js.get(i)).getString("pregunta"), JLabel.LEFT); lab1.setFont(new Font("Roboto", 1, 18)); lab1.setForeground(new Color(134, 36, 31)); panel.add(lab1); panel.add(new JLabel("")); JSONArray jarr = ((JSONObject) js.get(i)).getJSONArray("opciones"); for (int j = 0; j < jarr.length(); j++) { JLabel lab2 = new JLabel("Opcin " + (j + 1) + ": " + jarr.getString(j), JLabel.LEFT); JButton colBut = new JButton("Seleccionar color de la opcin"); colBut.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { jFrame1.setVisible(true); } }); lab2.setFont(new Font("Roboto", 1, 15)); lab2.setForeground(new Color(0, 0, 0)); panel.add(lab2); panel.add(colBut); } } catch (JSONException ex) { Logger.getLogger(AnalistaLocal.class.getName()).log(Level.SEVERE, null, ex); } } }
From source file:com.mirth.connect.client.ui.alert.DefaultAlertEditPanel.java
private void initComponents() { setBackground(UIConstants.BACKGROUND_COLOR); setLayout(new MigLayout("insets 10", "grow", "[][grow][grow]")); nameLabel = new JLabel("Alert Name: "); nameTextField = new MirthTextField(); nameTextField.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent evt) { parent.setPanelName("Edit Alert - " + nameTextField.getText()); }/*from w ww . j a v a 2 s. co m*/ }); enabledCheckBox = new MirthCheckBox("Enabled"); enabledCheckBox.setBackground(UIConstants.BACKGROUND_COLOR); JPanel headerPanel = new JPanel(); headerPanel.setBackground(UIConstants.BACKGROUND_COLOR); headerPanel.setLayout(new MigLayout("insets 0")); headerPanel.add(nameLabel, ""); headerPanel.add(nameTextField, "width 500"); headerPanel.add(enabledCheckBox, "wrap"); alertTriggerPane = new DefaultAlertTriggerPane(); alertChannelPane = new AlertChannelPane(); alertActionPane = new AlertActionPane(); add(headerPanel, "grow, span"); add(alertTriggerPane, "grow, sg 1, height 100"); add(alertChannelPane, "grow, sg 1, height 100, wrap"); add(alertActionPane, "grow, sgy 1, width 100, height 100, span"); }
From source file:sanger.team16.gui.genevar.eqtl.query.SNPGeneAssocPlot.java
public SNPGeneAssocPlot(List<Tuple> tuples, double max, double min) throws ArrayIndexOutOfBoundsException { JPanel mainPanel = new JPanel(new GridLayout(0, 3)); mainPanel.setBackground(Color.white); int size = tuples.size(); for (int i = 0; i < size; i++) { Tuple tuple = tuples.get(i);//from w ww. j a v a 2s .co m String populationName = tuple.populationName; // if (trait.expressionRanks != null) { // BUG FIXED 02/02/10 if (tuple.phenotypes != null && tuple.phenotypes.length != 0) { CategoryDataset dataset = this.createDataset(tuple); JFreeChart chart = createChart(populationName, dataset, max, min); chart.setBackgroundPaint(Color.white); TextTitle textTitle = new TextTitle(tuple.subtitle); textTitle.setFont(new Font("SansSerif", Font.PLAIN, 12)); //subtitle1.setPosition(RectangleEdge.BOTTOM); textTitle.setHorizontalAlignment(HorizontalAlignment.CENTER); chart.addSubtitle(textTitle); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(this.getAutoPreferredSize()); // Original Dimension(680, 420) mainPanel.add(chartPanel); } else { BaseJPane empty = new BaseJPane(2, 50, 0, 0); empty.setPreferredSize(this.getAutoPreferredSize()); BaseJPane na = new BaseJPane(); na.setLayout(new BorderLayout()); JLabel name = new JLabel(" " + populationName); name.setFont(new Font("Arial", Font.BOLD, 12)); name.setForeground(Color.gray); na.add(name, BorderLayout.PAGE_START); JLabel message = new JLabel("Not Available"); message.setForeground(Color.lightGray); na.add(message, BorderLayout.CENTER); empty.add(Box.createHorizontalGlue()); empty.add(na); empty.add(Box.createHorizontalGlue()); empty.setBaseSpringBox(); mainPanel.add(empty); } } this.add(mainPanel); }