Example usage for javax.swing JScrollPane setBackground

List of usage examples for javax.swing JScrollPane setBackground

Introduction

In this page you can find the example usage for javax.swing JScrollPane 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:lol.search.RankedStatsPage.java

private JScrollPane championSelectPanel() {
    JPanel mainPanel = new JPanel(new FlowLayout());
    //mainPanel.setBorder(BorderFactory.createLineBorder(Color.WHITE));
    mainPanel.setBackground(backgroundColor);
    for (int i = 0; i < this.objChampRankedList.size(); i++) {
        int position = counter;
        ImageIcon champImageIcon = this.OBJ_RANKED_STATS_BY_ID.getChampionIconOf(this.champKeyList.get(i));
        JButton champButton = new JButton();
        champButton.setIcon(champImageIcon);
        if (i == 0) {
            champButton.setIcon(this.profileIcon);
            champButton.setToolTipText("Overall Stats");
        }//from  w  ww . j  a  va  2s.c  om
        champButton.setPreferredSize(new Dimension(55, 55));
        champButton.setBackground(Color.BLACK);
        champButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) { //button pressed
                background.setIcon(OBJ_GAME_STATIC_DATA.getBackgroundImageIcon(champKeyList.get(position)));
                loadArtLabel.setIcon(OBJ_GAME_STATIC_DATA.initLoadingArt(champKeyList.get(position)));
                nameHeader.setText(OBJ_ALL_CHAMPS_BY_ID.getChampNameFromId(champIdList.get(position)));

                titleHeader.setText(" " + OBJ_ALL_CHAMPS_BY_ID.getChampTitleFromId(champIdList.get(position)));
                String sessionsWon = "";
                String sessionsLost = "";
                String winPercentString = "";
                try {
                    int won = objChampRankedList.get(position).getJSONObject("stats")
                            .getInt("totalSessionsWon");
                    sessionsWon = Integer.toString(won);
                    int lost = objChampRankedList.get(position).getJSONObject("stats")
                            .getInt("totalSessionsLost");
                    sessionsLost = Integer.toString(lost);
                    winPercentString = getWinPercentage(won, lost);
                    totalGamesInt = won + lost;
                    avgKillsLabelValue.setText(new DecimalFormat("##.##")
                            .format((double) objChampRankedList.get(position).getJSONObject("stats")
                                    .getInt("totalChampionKills") / (double) totalGamesInt));
                    avgAssistsLabelValue
                            .setText(new DecimalFormat("##.##").format((double) objChampRankedList.get(position)
                                    .getJSONObject("stats").getInt("totalAssists") / (double) totalGamesInt));
                    avgDeathsLabelValue.setText(new DecimalFormat("##.##")
                            .format((double) objChampRankedList.get(position).getJSONObject("stats")
                                    .getInt("totalDeathsPerSession") / (double) totalGamesInt));
                    avgMinionKillsLabelValue.setText(new DecimalFormat("##.##")
                            .format((double) objChampRankedList.get(position).getJSONObject("stats")
                                    .getInt("totalMinionKills") / (double) totalGamesInt));
                    avgDoubleKillsLabelValue.setText(new DecimalFormat("##.##")
                            .format((double) objChampRankedList.get(position).getJSONObject("stats")
                                    .getInt("totalDoubleKills") / (double) totalGamesInt));
                    avgTripleKillsLabelValue.setText(new DecimalFormat("##.##")
                            .format((double) objChampRankedList.get(position).getJSONObject("stats")
                                    .getInt("totalTripleKills") / (double) totalGamesInt));
                    avgQuadKillsLabelValue.setText(new DecimalFormat("##.##")
                            .format((double) objChampRankedList.get(position).getJSONObject("stats")
                                    .getInt("totalQuadraKills") / (double) totalGamesInt));
                    avgPentaKillsLabelValue.setText(new DecimalFormat("##.##")
                            .format((double) objChampRankedList.get(position).getJSONObject("stats")
                                    .getInt("totalPentaKills") / (double) totalGamesInt));
                    totalKillsLabelValue.setText(new DecimalFormat("#######").format((double) objChampRankedList
                            .get(position).getJSONObject("stats").getInt("totalChampionKills")));
                    totalDeathsLabelValue
                            .setText(new DecimalFormat("#######").format((double) objChampRankedList
                                    .get(position).getJSONObject("stats").getInt("totalDeathsPerSession")));
                    totalAssistsLabelValue
                            .setText(new DecimalFormat("#######").format((double) objChampRankedList
                                    .get(position).getJSONObject("stats").getInt("totalAssists")));
                    totalMinionsLabelValue
                            .setText(new DecimalFormat("#######").format((double) objChampRankedList
                                    .get(position).getJSONObject("stats").getInt("totalMinionKills")));
                    totalDoubleKillsLabelValue
                            .setText(new DecimalFormat("#######").format((double) objChampRankedList
                                    .get(position).getJSONObject("stats").getInt("totalDoubleKills")));
                    totalTripleKillsLabelValue
                            .setText(new DecimalFormat("#######").format((double) objChampRankedList
                                    .get(position).getJSONObject("stats").getInt("totalTripleKills")));
                    totalQuadKillsLabelValue
                            .setText(new DecimalFormat("#######").format((double) objChampRankedList
                                    .get(position).getJSONObject("stats").getInt("totalQuadraKills")));
                    totalPentaKillsLabelValue
                            .setText(new DecimalFormat("#######").format((double) objChampRankedList
                                    .get(position).getJSONObject("stats").getInt("totalPentaKills")));
                } catch (JSONException ex) {
                    Logger.getLogger(RankedStatsPage.class.getName()).log(Level.SEVERE, null, ex);
                }
                totalWins.setText(sessionsWon);
                totalLosses.setText(sessionsLost);
                winPercent.setText(winPercentString + "%");
                totalGamesPlayed.setText(String.valueOf(totalGamesInt));
                masterFrame.revalidate();
                masterFrame.repaint();
            }
        });
        champButton.setToolTipText(OBJ_ALL_CHAMPS_BY_ID.getChampNameFromId(champIdList.get(position)));
        champButtons.add(champButton);
        //champButton.setBorder(BorderFactory.createLineBorder(Color.BLACK));
        counter++;
    }
    for (int i = 0; i < champButtons.size(); i++) {
        mainPanel.add(champButtons.get(i));
        mainPanel.revalidate();
    }
    JScrollPane scrollPane = new JScrollPane(mainPanel);
    scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
    scrollPane.setPreferredSize(new Dimension(1200, 85));
    scrollPane.setBackground(new Color(0, 0, 0, 100));
    scrollPane.setBorder(BorderFactory.createLineBorder(Color.BLACK));
    scrollPane.getHorizontalScrollBar().setUI(new BasicScrollBarUI() {
        @Override
        protected void configureScrollBarColors() {
            this.thumbColor = new Color(124, 124, 124, 255);
            this.trackColor = Color.BLACK;
        }
    });

    return scrollPane;
}

From source file:sim.util.media.chart.ChartGenerator.java

/** Generates a new ChartGenerator with a blank chart.  Before anything else, buildChart() is called.  */
public ChartGenerator() {
    // create the chart
    buildChart();/*from ww w .  j av  a 2  s  .  co  m*/
    chart.getPlot().setBackgroundPaint(Color.WHITE);
    chart.setAntiAlias(true);

    JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true);
    split.setBorder(new EmptyBorder(0, 0, 0, 0));
    JScrollPane scroll = new JScrollPane();
    JPanel b = new JPanel();
    b.setLayout(new BorderLayout());
    b.add(seriesAttributes, BorderLayout.NORTH);
    b.add(new JPanel(), BorderLayout.CENTER);
    scroll.getViewport().setView(b);
    scroll.setBackground(getBackground());
    scroll.getViewport().setBackground(getBackground());
    JPanel p = new JPanel();
    p.setLayout(new BorderLayout());

    LabelledList list = new LabelledList("Chart Properties");
    DisclosurePanel pan1 = new DisclosurePanel("Chart Properties", list);
    globalAttributes.add(pan1);

    JLabel j = new JLabel("Right-Click or Control-Click");
    j.setFont(j.getFont().deriveFont(10.0f).deriveFont(java.awt.Font.ITALIC));
    list.add(j);
    j = new JLabel("on Chart for More Options");
    j.setFont(j.getFont().deriveFont(10.0f).deriveFont(java.awt.Font.ITALIC));
    list.add(j);

    titleField = new PropertyField() {
        public String newValue(String newValue) {
            setTitle(newValue);
            getChartPanel().repaint();
            return newValue;
        }
    };
    titleField.setValue(chart.getTitle().getText());

    list.add(new JLabel("Title"), titleField);

    buildGlobalAttributes(list);

    final JCheckBox legendCheck = new JCheckBox();
    ItemListener il = new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                LegendTitle title = new LegendTitle(chart.getPlot());
                title.setLegendItemGraphicPadding(new org.jfree.ui.RectangleInsets(0, 8, 0, 4));
                chart.addLegend(title);
            } else {
                chart.removeLegend();
            }
        }
    };
    legendCheck.addItemListener(il);
    list.add(new JLabel("Legend"), legendCheck);
    legendCheck.setSelected(true);

    /*
      final JCheckBox aliasCheck = new JCheckBox();
      aliasCheck.setSelected(chart.getAntiAlias());
      il = new ItemListener()
      {
      public void itemStateChanged(ItemEvent e)
      {
      chart.setAntiAlias( e.getStateChange() == ItemEvent.SELECTED );
      }
      };
      aliasCheck.addItemListener(il);
      list.add(new JLabel("Antialias"), aliasCheck);
    */

    JPanel pdfButtonPanel = new JPanel();
    pdfButtonPanel.setBorder(new javax.swing.border.TitledBorder("Chart Output"));
    DisclosurePanel pan2 = new DisclosurePanel("Chart Output", pdfButtonPanel);

    pdfButtonPanel.setLayout(new BorderLayout());
    Box pdfbox = new Box(BoxLayout.Y_AXIS);
    pdfButtonPanel.add(pdfbox, BorderLayout.WEST);

    JButton pdfButton = new JButton("Save as PDF");
    pdfbox.add(pdfButton);
    pdfButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            FileDialog fd = new FileDialog(frame, "Choose PDF file...", FileDialog.SAVE);
            fd.setFile(chart.getTitle().getText() + ".pdf");
            fd.setVisible(true);
            String fileName = fd.getFile();
            if (fileName != null) {
                Dimension dim = chartPanel.getPreferredSize();
                PDFEncoder.generatePDF(chart, dim.width, dim.height,
                        new File(fd.getDirectory(), Utilities.ensureFileEndsWith(fd.getFile(), ".pdf")));
            }
        }
    });
    movieButton = new JButton("Create a Movie");
    pdfbox.add(movieButton);
    pdfbox.add(Box.createGlue());
    movieButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (movieMaker == null)
                startMovie();
            else
                stopMovie();
        }
    });

    globalAttributes.add(pan2);

    // we add into an outer box so we can later on add more global seriesAttributes
    // as the user instructs and still have glue be last
    Box outerAttributes = Box.createVerticalBox();
    outerAttributes.add(globalAttributes);
    outerAttributes.add(Box.createGlue());

    p.add(outerAttributes, BorderLayout.NORTH);
    p.add(scroll, BorderLayout.CENTER);
    p.setMinimumSize(new Dimension(0, 0));
    p.setPreferredSize(new Dimension(200, 0));
    split.setLeftComponent(p);

    // Add scale and proportion fields
    Box header = Box.createHorizontalBox();

    final double MAXIMUM_SCALE = 8;

    fixBox = new JCheckBox("Fill");
    fixBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            setFixed(fixBox.isSelected());
        }
    });
    header.add(fixBox);
    fixBox.setSelected(true);

    // add the scale field
    scaleField = new NumberTextField("  Scale: ", 1.0, true) {
        public double newValue(double newValue) {
            if (newValue <= 0.0)
                newValue = currentValue;
            if (newValue > MAXIMUM_SCALE)
                newValue = currentValue;
            scale = newValue;
            resizeChart();
            return newValue;
        }
    };
    scaleField.setToolTipText("Zoom in and out");
    scaleField.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 2));
    scaleField.setEnabled(false);
    scaleField.setText("");
    header.add(scaleField);

    // add the proportion field
    proportionField = new NumberTextField("  Proportion: ", 1.5, true) {
        public double newValue(double newValue) {
            if (newValue <= 0.0)
                newValue = currentValue;
            proportion = newValue;
            resizeChart();
            return newValue;
        }
    };
    proportionField.setToolTipText("Change the chart proportions (ratio of width to height)");
    proportionField.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 2));
    header.add(proportionField);

    chartHolder.setMinimumSize(new Dimension(0, 0));
    chartHolder.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    chartHolder.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    chartHolder.getViewport().setBackground(Color.gray);
    JPanel p2 = new JPanel();
    p2.setLayout(new BorderLayout());
    p2.add(chartHolder, BorderLayout.CENTER);
    p2.add(header, BorderLayout.NORTH);
    split.setRightComponent(p2);
    setLayout(new BorderLayout());
    add(split, BorderLayout.CENTER);

    // set the default to be white, which looks good when printed
    chart.setBackgroundPaint(Color.WHITE);

    // JFreeChart has a hillariously broken way of handling font scaling.
    // It allows fonts to scale independently in X and Y.  We hack a workaround here.
    chartPanel.setMinimumDrawHeight((int) DEFAULT_CHART_HEIGHT);
    chartPanel.setMaximumDrawHeight((int) DEFAULT_CHART_HEIGHT);
    chartPanel.setMinimumDrawWidth((int) (DEFAULT_CHART_HEIGHT * proportion));
    chartPanel.setMaximumDrawWidth((int) (DEFAULT_CHART_HEIGHT * proportion));
    chartPanel.setPreferredSize(new java.awt.Dimension((int) (DEFAULT_CHART_HEIGHT * DEFAULT_CHART_PROPORTION),
            (int) (DEFAULT_CHART_HEIGHT)));
}

From source file:edu.gmu.cs.sim.util.media.chart.ChartGenerator.java

/** Generates a new ChartGenerator with a blank chart.  Before anything else, buildChart() is called.  */
public ChartGenerator() {
    // create the chart
    buildChart();/*from w  w w  .ja va 2s  .  co m*/
    chart.getPlot().setBackgroundPaint(Color.WHITE);
    chart.setAntiAlias(true);

    JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true);
    split.setBorder(new EmptyBorder(0, 0, 0, 0));
    JScrollPane scroll = new JScrollPane();
    JPanel b = new JPanel();
    b.setLayout(new BorderLayout());
    b.add(seriesAttributes, BorderLayout.NORTH);
    b.add(new JPanel(), BorderLayout.CENTER);
    scroll.getViewport().setView(b);
    scroll.setBackground(getBackground());
    scroll.getViewport().setBackground(getBackground());
    JPanel p = new JPanel();
    p.setLayout(new BorderLayout());

    LabelledList list = new LabelledList("Chart Properties");
    DisclosurePanel pan1 = new DisclosurePanel("Chart Properties", list);
    globalAttributes.add(pan1);

    JLabel j = new JLabel("Right-Click or Control-Click");
    j.setFont(j.getFont().deriveFont(10.0f).deriveFont(java.awt.Font.ITALIC));
    list.add(j);
    j = new JLabel("on Chart for More Options");
    j.setFont(j.getFont().deriveFont(10.0f).deriveFont(java.awt.Font.ITALIC));
    list.add(j);

    titleField = new PropertyField() {
        public String newValue(String newValue) {
            setTitle(newValue);
            getChartPanel().repaint();
            return newValue;
        }
    };
    titleField.setValue(chart.getTitle().getText());

    list.add(new JLabel("Title"), titleField);

    buildGlobalAttributes(list);

    final JCheckBox legendCheck = new JCheckBox();
    ItemListener il = new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                LegendTitle title = new LegendTitle(chart.getPlot());
                title.setLegendItemGraphicPadding(new org.jfree.ui.RectangleInsets(0, 8, 0, 4));
                chart.addLegend(title);
            } else {
                chart.removeLegend();
            }
        }
    };
    legendCheck.addItemListener(il);
    list.add(new JLabel("Legend"), legendCheck);
    legendCheck.setSelected(true);

    /*
      final JCheckBox aliasCheck = new JCheckBox();
      aliasCheck.setSelected(chart.getAntiAlias());
      il = new ItemListener()
      {
      public void itemStateChanged(ItemEvent e)
      {
      chart.setAntiAlias( e.getStateChange() == ItemEvent.SELECTED );
      }
      };
      aliasCheck.addItemListener(il);
      list.add(new JLabel("Antialias"), aliasCheck);
    */

    JPanel pdfButtonPanel = new JPanel();
    pdfButtonPanel.setBorder(new javax.swing.border.TitledBorder("Chart Output"));
    DisclosurePanel pan2 = new DisclosurePanel("Chart Output", pdfButtonPanel);

    pdfButtonPanel.setLayout(new BorderLayout());
    Box pdfbox = new Box(BoxLayout.Y_AXIS);
    pdfButtonPanel.add(pdfbox, BorderLayout.WEST);

    JButton pdfButton = new JButton("Save as PDF");
    pdfbox.add(pdfButton);
    pdfButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            FileDialog fd = new FileDialog(frame, "Choose PDF file...", FileDialog.SAVE);
            fd.setFile(chart.getTitle().getText() + ".pdf");
            fd.setVisible(true);
            String fileName = fd.getFile();
            if (fileName != null) {
                Dimension dim = chartPanel.getPreferredSize();
                PDFEncoder.generatePDF(chart, dim.width, dim.height,
                        new File(fd.getDirectory(), Utilities.ensureFileEndsWith(fd.getFile(), ".pdf")));
            }
        }
    });
    movieButton = new JButton("Create a Movie");
    pdfbox.add(movieButton);
    pdfbox.add(Box.createGlue());
    movieButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (movieMaker == null) {
                startMovie();
            } else {
                stopMovie();
            }
        }
    });

    globalAttributes.add(pan2);

    // we add into an outer box so we can later on add more global seriesAttributes
    // as the user instructs and still have glue be last
    Box outerAttributes = Box.createVerticalBox();
    outerAttributes.add(globalAttributes);
    outerAttributes.add(Box.createGlue());

    p.add(outerAttributes, BorderLayout.NORTH);
    p.add(scroll, BorderLayout.CENTER);
    p.setMinimumSize(new Dimension(0, 0));
    p.setPreferredSize(new Dimension(200, 0));
    split.setLeftComponent(p);

    // Add scale and proportion fields
    Box header = Box.createHorizontalBox();

    final double MAXIMUM_SCALE = 8;

    fixBox = new JCheckBox("Fill");
    fixBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            setFixed(fixBox.isSelected());
        }
    });
    header.add(fixBox);
    fixBox.setSelected(true);

    // add the scale field
    scaleField = new NumberTextField("  Scale: ", 1.0, true) {
        public double newValue(double newValue) {
            if (newValue <= 0.0) {
                newValue = currentValue;
            }
            if (newValue > MAXIMUM_SCALE) {
                newValue = currentValue;
            }
            scale = newValue;
            resizeChart();
            return newValue;
        }
    };
    scaleField.setToolTipText("Zoom in and out");
    scaleField.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 2));
    scaleField.setEnabled(false);
    scaleField.setText("");
    header.add(scaleField);

    // add the proportion field
    proportionField = new NumberTextField("  Proportion: ", 1.5, true) {
        public double newValue(double newValue) {
            if (newValue <= 0.0) {
                newValue = currentValue;
            }
            proportion = newValue;
            resizeChart();
            return newValue;
        }
    };
    proportionField.setToolTipText("Change the chart proportions (ratio of width to height)");
    proportionField.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 2));
    header.add(proportionField);

    chartHolder.setMinimumSize(new Dimension(0, 0));
    chartHolder.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    chartHolder.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    chartHolder.getViewport().setBackground(Color.gray);
    JPanel p2 = new JPanel();
    p2.setLayout(new BorderLayout());
    p2.add(chartHolder, BorderLayout.CENTER);
    p2.add(header, BorderLayout.NORTH);
    split.setRightComponent(p2);
    setLayout(new BorderLayout());
    add(split, BorderLayout.CENTER);

    // set the default to be white, which looks good when printed
    chart.setBackgroundPaint(Color.WHITE);

    // JFreeChart has a hillariously broken way of handling font scaling.
    // It allows fonts to scale independently in X and Y.  We hack a workaround here.
    chartPanel.setMinimumDrawHeight((int) DEFAULT_CHART_HEIGHT);
    chartPanel.setMaximumDrawHeight((int) DEFAULT_CHART_HEIGHT);
    chartPanel.setMinimumDrawWidth((int) (DEFAULT_CHART_HEIGHT * proportion));
    chartPanel.setMaximumDrawWidth((int) (DEFAULT_CHART_HEIGHT * proportion));
    chartPanel.setPreferredSize(new java.awt.Dimension((int) (DEFAULT_CHART_HEIGHT * DEFAULT_CHART_PROPORTION),
            (int) (DEFAULT_CHART_HEIGHT)));
}

From source file:SuitaDetails.java

public ParamPanel() {
    setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(new Color(153, 153, 153)),
            "Parameters", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null,
            new Color(0, 0, 0)));
    setBackground(Color.WHITE);//  w ww . j  a  v  a  2s . com
    jPanel2 = new JPanel();
    jPanel2.setBackground(Color.WHITE);
    JScrollPane jScrollPane3 = new JScrollPane(jPanel2);
    jScrollPane3.setBackground(Color.WHITE);
    jScrollPane3.setBorder(null);
    jPanel2.setLayout(new BoxLayout(jPanel2, BoxLayout.Y_AXIS));

    addpanel = new JPanel();
    addpanel.setMaximumSize(new Dimension(32767, 25));
    addpanel.setMinimumSize(new Dimension(0, 25));
    addpanel.setPreferredSize(new Dimension(50, 25));
    addpanel.setLayout(new BorderLayout());
    JButton add = new JButton("Add");
    add.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ev) {
            ArrayList<Integer> indexpos3 = (ArrayList<Integer>) parent.getPos().clone();
            indexpos3.add(new Integer(parent.getSubItemsNr()));
            Item property = new Item("param", 0, -1, -1, 10, 20, indexpos3);
            property.setSubItemVisible(false);
            property.setValue("");
            parent.addSubItem(property);
            Param prop = new Param(parent, property);
            jPanel2.remove(addpanel);
            jPanel2.add(prop);
            jPanel2.add(addpanel);
            jPanel2.revalidate();
            jPanel2.repaint();
        }
    });
    addpanel.add(add, BorderLayout.EAST);
    addpanel.setBackground(Color.WHITE);
    GroupLayout paramLayout = new GroupLayout(this);
    this.setLayout(paramLayout);
    paramLayout.setHorizontalGroup(
            paramLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jScrollPane3));
    paramLayout.setVerticalGroup(
            paramLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jScrollPane3));
}

From source file:SuitaDetails.java

public PropPanel() {
    jPanel1 = new JPanel();
    addpanel = new JPanel();
    addpanel.setMaximumSize(new Dimension(32767, 25));
    addpanel.setMinimumSize(new Dimension(0, 25));
    addpanel.setPreferredSize(new Dimension(50, 25));
    addpanel.setLayout(new BorderLayout());
    JButton add = new JButton("Add");
    add.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ev) {
            ArrayList<Integer> indexpos3 = (ArrayList<Integer>) parent.getPos().clone();
            indexpos3.add(new Integer(parent.getSubItemsNr()));
            Item property = new Item("", 0, -1, -1, 10, 20, indexpos3);
            property.setSubItemVisible(false);
            property.setValue("");
            parent.addSubItem(property);
            Prop prop = new Prop(parent, property);
            jPanel1.remove(addpanel);//from ww  w .  jav a 2  s.  c o  m
            jPanel1.add(prop);
            jPanel1.add(addpanel);
            jPanel1.revalidate();
            jPanel1.repaint();
        }
    });
    addpanel.add(add, BorderLayout.EAST);
    addpanel.setBackground(Color.WHITE);
    JScrollPane jScrollPane1 = new JScrollPane(jPanel1);
    jPanel1.setBackground(Color.WHITE);
    jScrollPane1.setBackground(Color.WHITE);
    jScrollPane1.setBorder(null);
    jPanel1.setLayout(new BoxLayout(jPanel1, BoxLayout.Y_AXIS));
    setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(new Color(153, 153, 153)),
            "Properties", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null,
            new Color(0, 0, 0)));
    setBackground(Color.WHITE);
    GroupLayout propLayout = new GroupLayout(this);
    setLayout(propLayout);
    propLayout.setHorizontalGroup(
            propLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jScrollPane1));
    propLayout.setVerticalGroup(
            propLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jScrollPane1));
}

From source file:interfazGrafica.loginInterface.java

private void consultarUsuariosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_consultarUsuariosActionPerformed
    // TODO add your handling code here:
    panelConsultas.removeAll();//  w  ww.j  a  va  2s. c  om
    String consultaSQL = "SELECT id_usuario, nombre_usuario, tipo_usuario, estado_usuario FROM usuarios;";
    ResultSet tabla = new OperacionesBD().consultas(consultaSQL);

    try {
        int count = 0;
        while (tabla.next()) {
            count++;
        }

        String[][] data = new String[count][4];
        int i = 0;
        tabla = new OperacionesBD().consultas(consultaSQL);
        while (tabla.next()) {
            data[i][0] = "" + tabla.getInt(1);
            data[i][1] = tabla.getString(2);
            data[i][2] = tabla.getString(3);
            if ("true".equals("" + tabla.getBoolean(4))) {
                data[i][3] = "Activo";
            } else {
                data[i][3] = "Inactivo";
            }
            i++;
        }
        String[] nombreColumnas = { "Identificador", "Nombre", "Rol", "Estado" };
        JTable tablaUsuario = new JTable(data, nombreColumnas);
        BorderLayout bl = new BorderLayout();
        panelConsultas.setLayout(bl);
        JScrollPane jsp = new JScrollPane(tablaUsuario);
        panelConsultas.add(jsp, BorderLayout.CENTER);
        jsp.setBackground(new Color(255, 255, 255));
        panelConsultas.setBackground(new Color(255, 255, 255));
        gerenteJFrame.getContentPane().add(panelContenedor);
        //gerenteJFrame.pack();
        //panelContenedor.setVisible(true);
        cl.show(panelContenedor, "Consultas");
        panelContenedor.repaint();
        panelConsultas.repaint();
        jsp.repaint();
        panelConsultas.setSize(780, 813);

    } catch (SQLException exc) {
        JOptionPane.showMessageDialog(null, "Error al acceder a la base de datos");
        exc.printStackTrace();
    }

}

From source file:org.dishevelled.brainstorm.BrainStorm.java

/**
 * Layout components./*w  w  w .j  a  v a2s. c o m*/
 */
private void layoutComponents() {
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    JScrollPane scrollPane = new JScrollPane(textArea);
    scrollPane.setBorder(null);
    scrollPane.setOpaque(true);
    scrollPane.setBackground(backgroundColor);
    scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
    add(placeholder);

    JPanel flow = new JPanel();
    flow.setLayout(new FlowLayout());
    flow.setOpaque(false);
    flow.add(scrollPane);

    add(flow);
    add(Box.createVerticalGlue());
    add(Box.createVerticalGlue());
}

From source file:org.isatools.isacreator.spreadsheet.Spreadsheet.java

public void instantiateSpreadsheet() {

    ResourceInjector.get("spreadsheet-package.style").inject(this);

    observers = new ArrayList<CopyPasteObserver>();

    spreadsheetPopups = new SpreadsheetPopupMenus(this);
    spreadsheetFunctions = new SpreadsheetFunctions(this);

    columnDependencies = new HashMap<TableColumn, List<TableColumn>>();
    Collections.synchronizedMap(columnDependencies);
    hiddenColumns = new HashSet<String>();

    setLayout(new BorderLayout());

    createSpreadsheetModel();// w w  w. j  a  v  a 2s  . c  om
    populateSpreadsheetWithContent();
    addOntologyTermsToUserHistory();

    // assign copy/paste listener
    new CopyPasteAdaptor(this);

    JScrollPane pane = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    pane.setBackground(UIHelper.BG_COLOR);
    pane.setAutoscrolls(true);
    pane.getViewport().setBackground(UIHelper.BG_COLOR);
    pane.setBorder(UIHelper.EMPTY_BORDER);

    IAppWidgetFactory.makeIAppScrollPane(pane);

    add(pane, BorderLayout.CENTER);

    createButtonPanel();
    addUndoableEditListener(undoManager);
}

From source file:org.isatools.isacreator.visualization.InvestigationInfoPanel.java

private JPanel prepareInvestigationInformation() {

    investigationInformation.removeAll();

    JEditorPane currentlyShowingInfo = new JEditorPane();
    currentlyShowingInfo.setContentType("text/html");
    currentlyShowingInfo.setEditable(false);
    currentlyShowingInfo.setBackground(UIHelper.BG_COLOR);

    JScrollPane infoScroller = new JScrollPane(currentlyShowingInfo, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    infoScroller.setBackground(UIHelper.BG_COLOR);
    infoScroller.getViewport().setBackground(UIHelper.BG_COLOR);
    infoScroller.setPreferredSize(new Dimension(width - 10, height - 50));
    infoScroller.setBorder(null);/* w ww  .  j  a  v  a 2s .c om*/

    IAppWidgetFactory.makeIAppScrollPane(infoScroller);

    Map<String, String> data = getInvestigationDetails();

    String labelContent = "<html>" + "<head>" + "<style type=\"text/css\">" + "<!--" + ".bodyFont {"
            + "   font-family: Verdana;" + "   font-size: 9px;" + "   color: #006838;" + "}" + "-->"
            + "</style>" + "</head>" + "<body class=\"bodyFont\">";

    for (Object key : data.keySet()) {
        labelContent += ("<p><b>" + ((String) key).trim() + ": </b>");
        labelContent += (data.get(key) + "</font></p>");
    }

    labelContent += "</body></html>";

    currentlyShowingInfo.setText(labelContent);

    investigationInformation.add(infoScroller);

    return investigationInformation;
}

From source file:org.isatools.isacreator.visualization.StudyInfoPanel.java

private JPanel prepareStudyInformation() {

    studyInformation.removeAll();//from www  . j a v  a2  s .  co  m

    JEditorPane currentlyShowingInfo = new JEditorPane();
    currentlyShowingInfo.setContentType("text/html");
    currentlyShowingInfo.setEditable(false);
    currentlyShowingInfo.setBackground(UIHelper.BG_COLOR);
    currentlyShowingInfo.setPreferredSize(new Dimension(width - 10, height - 30));

    JScrollPane infoScroller = new JScrollPane(currentlyShowingInfo, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    infoScroller.setBackground(UIHelper.BG_COLOR);
    infoScroller.getViewport().setBackground(UIHelper.BG_COLOR);
    infoScroller.setPreferredSize(new Dimension(width - 10, height - 50));
    infoScroller.setBorder(null);

    IAppWidgetFactory.makeIAppScrollPane(infoScroller);

    Map<String, String> data = getStudyDetails();

    String labelContent = "<html>" + "<head>" + "<style type=\"text/css\">" + "<!--" + ".bodyFont {"
            + "   font-family: Verdana;" + "   font-size: 9px;" + "   color: #006838;" + "}" + "-->"
            + "</style>" + "</head>" + "<body class=\"bodyFont\">";

    for (Object key : data.keySet()) {
        labelContent += ("<p><b>" + ((String) key).trim() + ": </b>");
        labelContent += (data.get(key) + "</font></p>");
    }

    labelContent += "</body></html>";

    currentlyShowingInfo.setText(labelContent);

    studyInformation.add(infoScroller);

    return studyInformation;
}