Example usage for javax.swing JPanel setBackground

List of usage examples for javax.swing JPanel setBackground

Introduction

In this page you can find the example usage for javax.swing JPanel setBackground.

Prototype

@BeanProperty(preferred = true, visualUpdate = true, description = "The background color of the component.")
public void setBackground(Color bg) 

Source Link

Document

Sets the background color of this component.

Usage

From source file:com.juanhg.pattern.PatternApplet.java

private void autogeneratedCode() {
    JPanel panel_control = new JPanel();
    panel_control.setBorder(new CompoundBorder(new EtchedBorder(EtchedBorder.RAISED, null, null),
            new BevelBorder(BevelBorder.RAISED, null, null, null, null)));

    JPanel panelInputs = new JPanel();
    panelInputs.setToolTipText("");
    panelInputs.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0)));

    JPanel panelOutputs = new JPanel();
    panelOutputs.setToolTipText("");
    panelOutputs.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0)));

    JPanel panelTitleOutputs = new JPanel();
    panelTitleOutputs.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null));

    JLabel labelOutputData = new JLabel("Datos de la Simulaci\u00F3n");
    labelOutputData.setFont(new Font("Tahoma", Font.PLAIN, 14));
    panelTitleOutputs.add(labelOutputData);

    lblO1 = new JLabel("O1:");
    lblO1.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblO1Value = new JLabel();
    lblO1Value.setText("0");
    lblO1Value.setFont(new Font("Tahoma", Font.PLAIN, 14));

    JLabel lblO2 = new JLabel("O2:");
    lblO2.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblO2Value = new JLabel();
    lblO2Value.setText("0");
    lblO2Value.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblO3 = new JLabel("O3:");
    lblO3.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblO3Value = new JLabel();
    lblO3Value.setText("0");
    lblO3Value.setFont(new Font("Tahoma", Font.PLAIN, 14));

    GroupLayout gl_panelOutputs = new GroupLayout(panelOutputs);
    gl_panelOutputs.setHorizontalGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING)
            .addComponent(panelTitleOutputs, GroupLayout.DEFAULT_SIZE, 344, Short.MAX_VALUE)
            .addGroup(gl_panelOutputs.createSequentialGroup().addGap(22).addGroup(gl_panelOutputs
                    .createParallelGroup(Alignment.LEADING)
                    .addGroup(gl_panelOutputs.createSequentialGroup()
                            .addComponent(lblO3, GroupLayout.PREFERRED_SIZE, 84, GroupLayout.PREFERRED_SIZE)
                            .addGap(26)/*from   ww w .  j a  v  a2  s  .co  m*/
                            .addComponent(lblO3Value, GroupLayout.DEFAULT_SIZE, 103, Short.MAX_VALUE))
                    .addGroup(gl_panelOutputs.createSequentialGroup()
                            .addGroup(gl_panelOutputs.createParallelGroup(Alignment.TRAILING)
                                    .addGroup(gl_panelOutputs.createSequentialGroup()
                                            .addComponent(lblO1, GroupLayout.DEFAULT_SIZE,
                                                    GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addGap(26))
                                    .addGroup(gl_panelOutputs.createSequentialGroup()
                                            .addComponent(lblO2, GroupLayout.PREFERRED_SIZE, 81,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addGap(29)))
                            .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING, false)
                                    .addComponent(lblO2Value, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(lblO1Value, GroupLayout.PREFERRED_SIZE, 103,
                                            GroupLayout.PREFERRED_SIZE))))
                    .addGap(109)));
    gl_panelOutputs
            .setVerticalGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING)
                    .addGroup(gl_panelOutputs.createSequentialGroup()
                            .addComponent(panelTitleOutputs, GroupLayout.PREFERRED_SIZE,
                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(ComponentPlacement.UNRELATED)
                            .addGroup(gl_panelOutputs.createParallelGroup(Alignment.BASELINE)
                                    .addComponent(lblO1Value).addComponent(lblO1))
                            .addPreferredGap(ComponentPlacement.UNRELATED)
                            .addGroup(gl_panelOutputs.createParallelGroup(Alignment.BASELINE)
                                    .addComponent(lblO2, GroupLayout.PREFERRED_SIZE, 17,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lblO2Value, GroupLayout.PREFERRED_SIZE, 17,
                                            GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(ComponentPlacement.UNRELATED)
                            .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING)
                                    .addComponent(lblO3, GroupLayout.PREFERRED_SIZE, 17,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lblO3Value, GroupLayout.PREFERRED_SIZE, 17,
                                            GroupLayout.PREFERRED_SIZE))
                            .addGap(79)));
    panelOutputs.setLayout(gl_panelOutputs);

    JPanel panelLicense = new JPanel();
    panelLicense.setBorder(new LineBorder(new Color(0, 0, 0)));

    JPanel panel_6 = new JPanel();
    panel_6.setBorder(new LineBorder(new Color(0, 0, 0)));
    GroupLayout gl_panel_control = new GroupLayout(panel_control);
    gl_panel_control.setHorizontalGroup(gl_panel_control.createParallelGroup(Alignment.TRAILING)
            .addGroup(gl_panel_control.createSequentialGroup().addContainerGap().addGroup(gl_panel_control
                    .createParallelGroup(Alignment.LEADING)
                    .addComponent(panelInputs, GroupLayout.PREFERRED_SIZE, 346, Short.MAX_VALUE)
                    .addComponent(panelOutputs, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(panel_6, Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 346, Short.MAX_VALUE)
                    .addComponent(panelLicense, GroupLayout.DEFAULT_SIZE, 346, Short.MAX_VALUE))
                    .addContainerGap()));
    gl_panel_control.setVerticalGroup(gl_panel_control.createParallelGroup(Alignment.TRAILING)
            .addGroup(gl_panel_control.createSequentialGroup().addContainerGap()
                    .addComponent(panelInputs, GroupLayout.PREFERRED_SIZE, 213, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(panelOutputs, GroupLayout.PREFERRED_SIZE, 129, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(panel_6, GroupLayout.PREFERRED_SIZE, 146, Short.MAX_VALUE)
                    .addPreferredGap(ComponentPlacement.RELATED).addComponent(panelLicense,
                            GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                    .addGap(24)));

    btnLaunchSimulation = new JButton("Iniciar");
    btnLaunchSimulation.setFont(new Font("Tahoma", Font.PLAIN, 16));
    btnLaunchSimulation.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            btnLaunchSimulationEvent(event);
        }
    });
    GroupLayout gl_panel_6 = new GroupLayout(panel_6);
    gl_panel_6.setHorizontalGroup(gl_panel_6.createParallelGroup(Alignment.TRAILING).addGroup(Alignment.LEADING,
            gl_panel_6.createSequentialGroup().addContainerGap()
                    .addComponent(btnLaunchSimulation, GroupLayout.DEFAULT_SIZE, 324, Short.MAX_VALUE)
                    .addContainerGap()));
    gl_panel_6.setVerticalGroup(gl_panel_6.createParallelGroup(Alignment.TRAILING).addGroup(Alignment.LEADING,
            gl_panel_6.createSequentialGroup().addGap(80)
                    .addComponent(btnLaunchSimulation, GroupLayout.PREFERRED_SIZE, 55,
                            GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    panel_6.setLayout(gl_panel_6);

    JLabel lblNewLabel = new JLabel("GNU GENERAL PUBLIC LICENSE");
    panelLicense.add(lblNewLabel);

    JLabel LabelI1 = new JLabel("I1");
    LabelI1.setFont(new Font("Tahoma", Font.PLAIN, 14));

    JLabel labelI2 = new JLabel("I2");
    labelI2.setFont(new Font("Tahoma", Font.PLAIN, 14));

    JLabel labelI3 = new JLabel("I3");
    labelI3.setFont(new Font("Tahoma", Font.PLAIN, 14));

    JPanel panelTitle = new JPanel();
    panelTitle.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null));

    lblI2Value = new JLabel("5");
    lblI2Value.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblI3Value = new JLabel("5");
    lblI3Value.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblI1Value = new JLabel("5");
    lblI1Value.setFont(new Font("Tahoma", Font.PLAIN, 14));

    sliderI1 = new JSlider();
    sliderI1.setMaximum(10);
    sliderI1.setMinorTickSpacing(1);
    sliderI1.setValue(5);
    sliderI1.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent event) {
            sliderI1Event();
        }
    });

    sliderI2 = new JSlider();
    sliderI2.setMaximum(10);
    sliderI2.setMinorTickSpacing(1);
    sliderI2.setValue(5);
    sliderI2.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            sliderI2Event();
        }
    });

    sliderI3 = new JSlider();
    sliderI3.setMaximum(10);
    sliderI3.setValue(5);
    sliderI3.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            sliderI3Event();
        }
    });

    JLabel lblI4 = new JLabel("I4");
    lblI4.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblI4Value = new JLabel("5");
    lblI4Value.setFont(new Font("Tahoma", Font.PLAIN, 14));

    sliderI4 = new JSlider();
    sliderI4.setMaximum(10);
    sliderI4.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent arg0) {
            sliderI4Event();
        }
    });
    sliderI4.setValue(5);
    sliderI4.setMinorTickSpacing(1);

    JLabel lblI5 = new JLabel("I5");
    lblI5.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblI5Value = new JLabel("5");
    lblI5Value.setFont(new Font("Tahoma", Font.PLAIN, 14));

    sliderI5 = new JSlider();
    sliderI5.setMaximum(10);
    sliderI5.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            sliderI5Event();
        }
    });
    sliderI5.setValue(5);
    sliderI5.setMinorTickSpacing(1);

    GroupLayout gl_panelInputs = new GroupLayout(panelInputs);
    gl_panelInputs.setHorizontalGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING)
            .addGroup(gl_panelInputs.createSequentialGroup().addGroup(gl_panelInputs
                    .createParallelGroup(Alignment.LEADING)
                    .addGroup(gl_panelInputs.createSequentialGroup()
                            .addGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING, false)
                                    .addComponent(labelI3, Alignment.LEADING, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(LabelI1, Alignment.LEADING, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(labelI2, Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 120,
                                            GroupLayout.PREFERRED_SIZE))
                            .addGap(18)
                            .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                                    .addComponent(lblI1Value, GroupLayout.PREFERRED_SIZE, 42,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lblI2Value, GroupLayout.PREFERRED_SIZE, 56,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lblI3Value, GroupLayout.PREFERRED_SIZE, 56,
                                            GroupLayout.PREFERRED_SIZE))
                            .addGap(18)
                            .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING, false)
                                    .addComponent(sliderI1, 0, 0, Short.MAX_VALUE)
                                    .addComponent(sliderI2, 0, 0, Short.MAX_VALUE).addComponent(
                                            sliderI3, GroupLayout.PREFERRED_SIZE, 88,
                                            GroupLayout.PREFERRED_SIZE)))
                    .addGroup(gl_panelInputs.createSequentialGroup()
                            .addComponent(lblI4, GroupLayout.PREFERRED_SIZE, 120, GroupLayout.PREFERRED_SIZE)
                            .addGap(18)
                            .addComponent(lblI4Value, GroupLayout.PREFERRED_SIZE, 56,
                                    GroupLayout.PREFERRED_SIZE)
                            .addGap(18)
                            .addComponent(sliderI4, GroupLayout.PREFERRED_SIZE, 88, GroupLayout.PREFERRED_SIZE))
                    .addGroup(gl_panelInputs.createSequentialGroup()
                            .addComponent(lblI5, GroupLayout.PREFERRED_SIZE, 120, GroupLayout.PREFERRED_SIZE)
                            .addGap(18)
                            .addComponent(lblI5Value, GroupLayout.PREFERRED_SIZE, 56,
                                    GroupLayout.PREFERRED_SIZE)
                            .addGap(18).addComponent(sliderI5, GroupLayout.PREFERRED_SIZE, 88,
                                    GroupLayout.PREFERRED_SIZE)))
                    .addGap(19))
            .addComponent(panelTitle, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 352, Short.MAX_VALUE));
    gl_panelInputs.setVerticalGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panelInputs.createSequentialGroup()
                    .addComponent(panelTitle, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addGap(18)
                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                            .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE)
                                    .addComponent(LabelI1).addComponent(lblI1Value, GroupLayout.PREFERRED_SIZE,
                                            17, GroupLayout.PREFERRED_SIZE))
                            .addComponent(sliderI1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                            .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE)
                                    .addComponent(labelI2).addComponent(lblI2Value, GroupLayout.PREFERRED_SIZE,
                                            17, GroupLayout.PREFERRED_SIZE))
                            .addComponent(sliderI2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE))
                    .addGap(11)
                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING).addComponent(labelI3)
                            .addComponent(lblI3Value, GroupLayout.PREFERRED_SIZE, 17,
                                    GroupLayout.PREFERRED_SIZE)
                            .addComponent(sliderI3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(ComponentPlacement.UNRELATED)
                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                            .addComponent(lblI4, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblI4Value, GroupLayout.PREFERRED_SIZE, 17,
                                    GroupLayout.PREFERRED_SIZE)
                            .addComponent(sliderI4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(ComponentPlacement.UNRELATED)
                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                            .addComponent(lblI5, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblI5Value, GroupLayout.PREFERRED_SIZE, 17,
                                    GroupLayout.PREFERRED_SIZE)
                            .addComponent(sliderI5, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE))
                    .addGap(429)));

    JLabel lblDatosDeEntrada = new JLabel("Datos de Entrada");
    lblDatosDeEntrada.setFont(new Font("Tahoma", Font.PLAIN, 14));
    panelTitle.add(lblDatosDeEntrada);
    panelInputs.setLayout(gl_panelInputs);
    panel_control.setLayout(gl_panel_control);

    JPanel panel_visualizar = new JPanel();
    panel_visualizar.setBackground(Color.WHITE);

    GroupLayout groupLayout = new GroupLayout(getContentPane());
    groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(groupLayout.createSequentialGroup().addContainerGap()
                    .addComponent(panel_control, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(panel_visualizar, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addContainerGap()));
    groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.TRAILING).addGroup(groupLayout
            .createSequentialGroup()
            .addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
                    .addGroup(groupLayout.createSequentialGroup().addContainerGap().addComponent(panel_control,
                            GroupLayout.PREFERRED_SIZE, 568, GroupLayout.PREFERRED_SIZE))
                    .addGroup(groupLayout.createSequentialGroup().addGap(12).addComponent(panel_visualizar,
                            GroupLayout.DEFAULT_SIZE, 567, Short.MAX_VALUE)))
            .addContainerGap()));
    GroupLayout gl_panel_visualizar = new GroupLayout(panel_visualizar);
    gl_panel_visualizar.setHorizontalGroup(
            gl_panel_visualizar.createParallelGroup(Alignment.LEADING).addGap(0, 845, Short.MAX_VALUE));
    gl_panel_visualizar.setVerticalGroup(
            gl_panel_visualizar.createParallelGroup(Alignment.LEADING).addGap(0, 567, Short.MAX_VALUE));

    panel_visualizar.setLayout(gl_panel_visualizar);

    getContentPane().setLayout(groupLayout);
}

From source file:lcmc.common.ui.EditableInfo.java

/** Creates revert button and adds it to the panel. */
protected final void addRevertButton(final JPanel panel) {
    final JPanel p = new JPanel(new FlowLayout(FlowLayout.TRAILING, 4, 0));
    p.setBackground(Browser.BUTTON_PANEL_BACKGROUND);
    p.add(revertButton);//  w w w  .  j av  a  2 s. com
    panel.add(p, BorderLayout.CENTER);
}

From source file:userinterface.graph.GraphOptionsPanel.java

/** Creates new form GraphOptionsPanel */
public GraphOptionsPanel(GUIPlugin plugin, JFrame parent, JPanel theModel) {
    this.plugin = plugin;
    this.parent = parent;
    this.theModel = theModel;

    /* TODO: Use generic container. */
    ArrayList own = new ArrayList();
    own.add(theModel);/*from   w ww . ja  v a2  s. com*/

    graphPropertiesTable = new SettingTable(parent);
    graphPropertiesTable.setOwners(own);

    if (theModel instanceof Graph) {

        ((Graph) theModel).setDisplay(graphPropertiesTable);
        xAxisSettings = ((Graph) theModel).getXAxisSettings();
        yAxisSettings = ((Graph) theModel).getYAxisSettings();
        zAxisSettings = null;
        displaySettings = ((Graph) theModel).getDisplaySettings();

    } else if (theModel instanceof Histogram) {

        ((Histogram) theModel).setDisplay(graphPropertiesTable);
        xAxisSettings = ((Histogram) theModel).getXAxisSettings();
        yAxisSettings = ((Histogram) theModel).getYAxisSettings();
        zAxisSettings = null;
        displaySettings = ((Histogram) theModel).getDisplaySettings();
    } else if (theModel instanceof Graph3D) {

        ((Graph3D) theModel).setDisplay(graphPropertiesTable);
        xAxisSettings = ((Graph3D) theModel).getxAxisSetting();
        yAxisSettings = ((Graph3D) theModel).getyAxisSetting();
        zAxisSettings = null;
        //zAxisSettings = ((Graph3D)theModel).getzAxisSetting();
        displaySettings = ((Graph3D) theModel).getDisplaySettings();
    }

    String[] axes = { "x-Axis", "y-Axis" };
    axesList = new JList(axes);
    axesList.setSelectedIndex(0);

    axesList.addListSelectionListener(this);

    own = new ArrayList();
    own.add(xAxisSettings);
    axisPropertiesTable = new SettingTable(parent);
    axisPropertiesTable.setOwners(own);

    if (theModel instanceof Graph) {

        ((AxisSettings) xAxisSettings).setDisplay(axisPropertiesTable);
        ((AxisSettings) yAxisSettings).setDisplay(axisPropertiesTable);

    } else if (theModel instanceof Histogram) {

        ((AxisSettingsHistogram) xAxisSettings).setDisplay(axisPropertiesTable);
        ((AxisSettingsHistogram) yAxisSettings).setDisplay(axisPropertiesTable);
    } else {

        ((AxisSettings3D) xAxisSettings).setDisplay(axisPropertiesTable);
        ((AxisSettings3D) yAxisSettings).setDisplay(axisPropertiesTable);
    }

    own = new ArrayList();
    own.add(displaySettings);
    displayPropertiesTable = new SettingTable(parent);
    displayPropertiesTable.setOwners(own);

    if (theModel instanceof ChartPanel)
        ((DisplaySettings) displaySettings).setDisplay(displayPropertiesTable);
    else if (theModel instanceof Graph3D)
        ((DisplaySettings3D) displaySettings).setDisplay(displayPropertiesTable);

    if (theModel instanceof Graph) {
        seriesList = new JList(((Graph) theModel).getGraphSeriesList());
    } else if (theModel instanceof Histogram) {

        seriesList = new JList(((Histogram) theModel).getGraphSeriesList());
    } else if (theModel instanceof Graph3D) {

        seriesList = new JList(((Graph3D) theModel).getGraphSeriesList());
    }

    seriesList.addListSelectionListener(this);

    seriesList.setCellRenderer(new ListCellRenderer() {

        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
                boolean cellHasFocus) {
            JLabel label = new JLabel((value == null) ? "undefined" : value.toString());
            JPanel panel = new JPanel();

            panel.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0));

            if (isSelected) {
                panel.setBackground(list.getSelectionBackground());
                panel.setForeground(list.getSelectionForeground());
            } else {
                panel.setBackground(list.getBackground());
                panel.setForeground(list.getForeground());
            }

            if (value instanceof SeriesSettings) {
                SeriesSettings graphSeries = (SeriesSettings) value;
                panel.add(graphSeries.getIcon());
            }

            panel.add(label);

            return panel;
        }
    });

    seriesPropertiesTable = new SettingTable(parent);

    /*seriesList = theModel.getSeriesList();
    seriesList.addListSelectionListener(this);
    //seriesModel = new PropertyTableModel();
    ArrayList ss = seriesList.getSelectedSeries();
    //seriesModel.setOwners(ss);
            
    seriesProperties = new SettingTable(parent);
    seriesProperties.setOwners(ss);*/
    initComponents();
    //addSeries.setEnabled(ss.size() > 0);
    /*removeSeries.setEnabled(ss.size() > 0);
    moveUp.setEnabled(ss.size() > 0);
    moveDown.setEnabled(ss.size() > 0);
    viewData.setEnabled(ss.size() > 0);*/

}

From source file:lcmc.common.ui.EditableInfo.java

/**
 * Creates panel with border and title for parameters with specified
 * background.//from  www. j  a  va2  s .  com
 */
protected final JPanel getParamPanel(final String title, final Color background) {
    final JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
    panel.setBackground(background);
    final TitledBorder titleBorder = Tools.getBorder(title);
    panel.setBorder(titleBorder);
    return panel;
}

From source file:lol.search.RankedStatsPage.java

private JPanel headerPanel() {
    //init spacers for header
    for (int i = 0; i < 10; i++) {
        JLabel label = new JLabel("--");
        label.setForeground(new Color(0, 0, 0, 0));
        spacers.add(label);//from  w w  w. j  a  v  a2  s  .  c o  m
    }
    //header -- to set this semi-transparent i had to remove setOpaque and replace with setBackground(...)
    JPanel headerPanel = new JPanel();
    headerPanel.setLayout(new BorderLayout());
    //headerPanel.setBorder(BorderFactory.createLineBorder(Color.WHITE));
    headerPanel.setBackground(backgroundColor);
    headerPanel.setPreferredSize(headerDimension);
    //back button
    JPanel buttonHolder = new JPanel();
    ImageIcon buttonImage = new ImageIcon("assets\\other\\button.png");
    ImageIcon buttonPressedImage = new ImageIcon("assets\\other\\buttonPressed.png");
    Image tempImage = buttonImage.getImage();
    Image newTempImg = tempImage.getScaledInstance(75, 35, Image.SCALE_SMOOTH);
    buttonImage = new ImageIcon(newTempImg);
    JButton backButton = new JButton("BACK");
    backButton.setFont(new Font("Sen-Regular", Font.CENTER_BASELINE, 10)); //custom font
    backButton.setForeground(Color.WHITE); //text color
    backButton.setBackground(new Color(0, 0, 0, 0));
    backButton.setBorder(BorderFactory.createLineBorder(Color.BLACK));
    backButton.setHorizontalTextPosition(AbstractButton.CENTER);
    backButton.setPreferredSize(new Dimension(75, 35));
    //pressed button
    Image tempImage2 = buttonPressedImage.getImage();
    Image newTempImg2 = tempImage2.getScaledInstance(75, 35, Image.SCALE_SMOOTH);
    buttonPressedImage = new ImageIcon(newTempImg2);
    backButton.setIcon(buttonImage);
    backButton.setRolloverIcon(buttonPressedImage);
    backButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) { //button pressed
            System.out.println("Going back...\n");
            masterFrame.getContentPane().removeAll();
            masterFrame.revalidate();
            masterFrame.repaint();
            MainPage MAIN_PAGE = new MainPage(masterFrame, summonerName);
        }
    });
    buttonHolder.add(backButton);
    buttonHolder.setOpaque(false);
    headerPanel.add(buttonHolder, BorderLayout.LINE_START);
    //centerpanel
    JPanel centerPanel = new JPanel();
    centerPanel.setLayout(new GridLayout(1, 2));
    centerPanel.setOpaque(false);
    //centerPanel.setBorder(BorderFactory.createLineBorder(Color.WHITE));
    //rightcenter
    JPanel rightCenter = new JPanel();
    rightCenter.setOpaque(false);
    rightCenter.setLayout(new GridLayout(2, 1));
    //top center panel
    JPanel topCenter = new JPanel();
    topCenter.setOpaque(false);
    topCenter.setLayout(new BoxLayout(topCenter, BoxLayout.X_AXIS));
    //profile icon
    JPanel proIconPanel = new JPanel();
    proIconPanel.setOpaque(false);
    proIconPanel.setLayout(new BoxLayout(proIconPanel, BoxLayout.Y_AXIS));
    JLabel profileIconLabel = new JLabel(this.profileIcon);
    //profileIconLabel.setBorder(BorderFactory.createLineBorder(Color.WHITE));
    profileIconLabel.setAlignmentX(Component.RIGHT_ALIGNMENT);
    proIconPanel.add(profileIconLabel);
    centerPanel.add(proIconPanel);
    //empty spacer
    topCenter.add(spacers.get(0));
    //summoner name
    JLabel summonerNameLabel = new JLabel(this.summonerName);
    summonerNameLabel.setFont(new Font("Sen-Regular", Font.CENTER_BASELINE, 15)); //custom font
    summonerNameLabel.setForeground(Color.WHITE); //text color
    summonerNameLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
    topCenter.add(summonerNameLabel);
    //empty spacer
    topCenter.add(spacers.get(1));
    //tier
    JLabel tierLabel = new JLabel(this.tier);
    tierLabel.setFont(new Font("Sen-Regular", Font.CENTER_BASELINE, 13)); //custom font
    tierLabel.setForeground(new Color(219, 219, 219)); //text color
    tierLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
    topCenter.add(tierLabel);
    //empty spacer
    topCenter.add(spacers.get(2));
    //division
    JLabel divisionLabel = new JLabel(this.division);
    divisionLabel.setFont(new Font("Sen-Regular", Font.CENTER_BASELINE, 13)); //custom font
    divisionLabel.setForeground(new Color(219, 219, 219)); //text color
    divisionLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
    topCenter.add(divisionLabel);
    //bottom center panel
    JPanel bottomCenter = new JPanel();
    bottomCenter.setOpaque(false);
    bottomCenter.setLayout(new BoxLayout(bottomCenter, BoxLayout.X_AXIS));
    //empty spacer
    bottomCenter.add(spacers.get(3));
    //season
    JLabel winsLabel = new JLabel(this.season);
    winsLabel.setFont(new Font("Sen-Regular", Font.CENTER_BASELINE, 14)); //custom font
    winsLabel.setForeground(new Color(219, 219, 219)); //text color
    winsLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
    bottomCenter.add(winsLabel);

    rightCenter.add(topCenter);
    rightCenter.add(bottomCenter);
    centerPanel.add(rightCenter);
    headerPanel.add(centerPanel, BorderLayout.CENTER);
    //empty panel to balance right side
    JPanel ee = new JPanel();
    ee.setOpaque(false);
    ee.setPreferredSize(new Dimension(260, 50));
    headerPanel.add(ee, BorderLayout.LINE_END);
    return headerPanel;
}

From source file:lcmc.gui.resources.EditableInfo.java

/** Creates revert button and adds it to the panel. */
protected final void addRevertButton(final JPanel panel) {
    final JPanel p = new JPanel(new FlowLayout(FlowLayout.RIGHT, 4, 0));
    p.setBackground(Browser.BUTTON_PANEL_BACKGROUND);
    p.add(revertButton);/*  w  w  w. j a va2s.c om*/
    panel.add(p, BorderLayout.CENTER);
}

From source file:lcmc.gui.resources.EditableInfo.java

/**
 * Creates panel with border and title for parameters with specified
 * background.// w  w w  . j  a  v a 2 s . c  o  m
 */
protected final JPanel getParamPanel(final String title, final Color background) {
    final JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    panel.setBackground(background);
    final TitledBorder titleBorder = Tools.getBorder(title);
    panel.setBorder(titleBorder);
    return panel;
}

From source file:com.isencia.passerelle.hmi.generic.GenericHMI.java

/**
 * @param nObj/*  w w w .  ja v  a2s .c  o  m*/
 * @param panel
 * @return true if a form was effectively rendered, i.e. when at least 1
 *         parameter was available
 * @throws IllegalActionException
 */
private boolean renderModelComponent(final boolean deep, final NamedObj nObj, final JPanel panel) {
    if (logger.isDebugEnabled()) {
        logger.debug("renderModelComponent() - Entity " + nObj.getFullName()); //$NON-NLS-1$ //$NON-NLS-2$
    }
    if (nObj instanceof CompositeActor && deep) {
        return renderCompositeModelComponent((CompositeActor) nObj, panel);
    } else {
        renderModelComponentAnnotations(nObj, panel);
        final IPasserelleEditorPaneFactory epf = getEditorPaneFactoryForComponent(nObj);
        Component component = null;
        // XXX: temp need to use the new isencia api
        final IPasserelleQuery passerelleQuery = epf.createEditorPaneWithAuthorizer(nObj, this, this);
        if (!passerelleQuery.hasAutoSync()) {
            try {
                final Set<ParameterToWidgetBinder> queryBindings = passerelleQuery.getParameterBindings();
                for (final ParameterToWidgetBinder parameterToWidgetBinder : queryBindings) {
                    hmiFields.put(parameterToWidgetBinder.getBoundParameter().getFullName(),
                            parameterToWidgetBinder);
                }
            } catch (final Exception exception) {
                throw new RuntimeException("Error creating bindings for passerelleQuery", exception);
            }
        }

        final IPasserelleComponent passerelleComponent = passerelleQuery.getPasserelleComponent();
        if (!(passerelleComponent instanceof Component)) {
            return false;
        }

        component = (Component) passerelleComponent;
        // System.out.println("renderModelComponent "+passerelleComponent);
        // Component c =
        // EditorPaneFactory.createEditorPaneWithAuthorizer(nObj, this,
        // this);
        if (component != null && !(component instanceof PasserelleEmptyQuery)) {
            final String name = ModelUtils.getFullNameButWithoutModelName(getCurrentModel(), nObj);
            component.setName(name);
            final JPanel globalPanel = new JPanel(new BorderLayout());

            // Panel for title
            final JPanel titlePanel = createTitlePanel(name);

            // Add a nice background to panels
            titlePanel.setBackground(panel.getBackground());
            ((JComponent) component).setBackground(panel.getBackground());
            // Border
            final Border loweredbevel = BorderFactory.createLoweredBevelBorder();
            final TitledBorder border = BorderFactory.createTitledBorder(loweredbevel/* ,name */);
            globalPanel.setBorder(border);

            globalPanel.add(titlePanel, BorderLayout.NORTH);
            globalPanel.add(component, BorderLayout.CENTER);
            panel.add(globalPanel);

            // StateMachine stuff
            StateMachine.getInstance().registerActionForState(StateMachine.MODEL_OPEN, name, component);
            StateMachine.getInstance().compile();
            return true;
        }
        return false;
    }
}

From source file:es.emergya.ui.gis.popups.ConsultaHistoricos.java

private JPanel getVentanaMensaje() {
    JPanel panel = new JPanel(new BorderLayout());
    panel.setBackground(Color.WHITE);
    mensaje.setOpaque(false);/*from ww w .  ja  v a 2  s  .  co m*/
    mensaje.setBorder(null);
    mensaje.setForeground(Color.RED);
    mensaje.setEditable(false);
    panel.add(mensaje, BorderLayout.CENTER);
    return panel;
}

From source file:InternalFrameListenerDemo.java

public InternalFrameListenerDemo() {
    setTitle("Animated InternalFrameListener");
    m_count = m_tencount = 0;/*from  w ww .  jav a  2s. co m*/

    JPanel innerListenerPanel = new JPanel(new GridLayout(7, 1));
    JPanel listenerPanel = new JPanel(new BorderLayout());
    m_ifEventCanvas = new IFEventCanvas();

    m_lOpened = new JLabel("internalFrameOpened");
    m_lClosing = new JLabel("internalFrameClosing");
    m_lClosed = new JLabel("internalFrameClosed");
    m_lIconified = new JLabel("internalFrameIconified");
    m_lDeiconified = new JLabel("internalFrameDeiconified");
    m_lActivated = new JLabel("internalFrameActivated");
    m_lDeactivated = new JLabel("internalFrameDeactivated");

    innerListenerPanel.add(m_lOpened);
    innerListenerPanel.add(m_lClosing);
    innerListenerPanel.add(m_lClosed);
    innerListenerPanel.add(m_lIconified);
    innerListenerPanel.add(m_lDeiconified);
    innerListenerPanel.add(m_lActivated);
    innerListenerPanel.add(m_lDeactivated);

    listenerPanel.add("Center", m_ifEventCanvas);
    listenerPanel.add("West", innerListenerPanel);
    listenerPanel.setOpaque(true);
    listenerPanel.setBackground(Color.white);

    m_desktop = new JDesktopPane();
    m_desktop.setBorder(new SoftBevelBorder(BevelBorder.LOWERED));
    m_newFrame = new JButton("New Frame");
    m_newFrame.addActionListener(this);
    m_infos = UIManager.getInstalledLookAndFeels();
    String[] LAFNames = new String[m_infos.length];
    for (int i = 0; i < m_infos.length; i++) {
        LAFNames[i] = m_infos[i].getName();
    }
    m_UIBox = new JComboBox(LAFNames);
    m_UIBox.addActionListener(this);
    JPanel topPanel = new JPanel(true);
    topPanel.setLayout(new FlowLayout());
    topPanel.setBorder(new CompoundBorder(new SoftBevelBorder(BevelBorder.LOWERED),
            new CompoundBorder(new EmptyBorder(2, 2, 2, 2), new SoftBevelBorder(BevelBorder.RAISED))));
    getContentPane().setLayout(new BorderLayout());
    getContentPane().add("North", topPanel);
    getContentPane().add("Center", m_desktop);
    getContentPane().add("South", listenerPanel);
    ((JPanel) getContentPane()).setBorder(new CompoundBorder(new SoftBevelBorder(BevelBorder.LOWERED),
            new CompoundBorder(new EmptyBorder(1, 1, 1, 1), new SoftBevelBorder(BevelBorder.RAISED))));
    topPanel.add(m_newFrame);
    topPanel.add(new JLabel("Look & Feel:", SwingConstants.RIGHT));
    topPanel.add(m_UIBox);
    setSize(645, 500);
    Dimension dim = getToolkit().getScreenSize();
    setLocation(dim.width / 2 - getWidth() / 2, dim.height / 2 - getHeight() / 2);
    setVisible(true);
    WindowListener l = new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    };
    addWindowListener(l);
    m_eventTimer = new Timer(1000, this);
    m_eventTimer.setRepeats(true);
    m_eventTimer.start();
}