List of usage examples for javax.swing.border TitledBorder TitledBorder
public TitledBorder(Border border)
From source file:edu.clemson.cs.nestbed.client.gui.TestbedManagerFrame.java
private final JPanel buildProjectPanel() { JPanel projectPanel = new JPanel(new BorderLayout()); projectPanel.setBorder(new TitledBorder("Projects")); // --- left-side ------------------------------------------------- JPanel sidePanel = new JPanel(new BorderLayout()); sidePanel.setPreferredSize(new Dimension(WINDOW_WIDTH / 3, SIZE_IGNORED)); projectList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); projectList.addListSelectionListener(new ProjectListSelectionListener()); sidePanel.add(new JScrollPane(projectList), BorderLayout.CENTER); projectPanel.add(sidePanel, BorderLayout.WEST); // --- right-side ------------------------------------------------ sidePanel = new JPanel(new BorderLayout()); sidePanel.setPreferredSize(new Dimension(310, SIZE_IGNORED)); JPanel rsTopPanel = new JPanel(new BorderLayout()); rsTopPanel.setPreferredSize(new Dimension(SIZE_IGNORED, 50)); JPanel labelPanel = new JPanel(new GridLayout(2, 1, 0, 5)); labelPanel.add(new JLabel("Name: ")); labelPanel.add(new JLabel("Description: ")); JPanel infoPanel = new JPanel(new GridLayout(2, 1, 0, 5)); infoPanel.add(projectName);/*from w w w . j ava 2 s. co m*/ projectName.setEditable(false); infoPanel.add(projectDescription); projectDescription.setEditable(false); rsTopPanel.add(labelPanel, BorderLayout.WEST); rsTopPanel.add(infoPanel, BorderLayout.CENTER); sidePanel.add(rsTopPanel, BorderLayout.NORTH); projectPanel.add(sidePanel, BorderLayout.EAST); return projectPanel; }
From source file:com.floreantpos.main.SetUpWindow.java
private JPanel createTerminalConfigPanel() { JPanel contentPanel = new JPanel(new MigLayout("fill,hidemode 3", "[150px][fill, grow]", "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ contentPanel.setBorder(new TitledBorder(Messages.getString("SetUpWindow.20"))); //$NON-NLS-1$ tfTerminalNumber = new IntegerTextField(); tfTerminalNumber.setColumns(10);//from w ww.j av a2 s . c om contentPanel.add(new JLabel(Messages.getString("SetUpWindow.21"))); //$NON-NLS-1$ contentPanel.add(tfTerminalNumber, "aligny top,wrap"); //$NON-NLS-1$ tfSecretKeyLength = new IntegerTextField(3); contentPanel.add(new JLabel("Default password length")); //$NON-NLS-1$ contentPanel.add(tfSecretKeyLength, "wrap"); //$NON-NLS-1$ chkAutoLogoff = new JCheckBox(Messages.getString("SetUpWindow.22")); //$NON-NLS-1$ tfLogoffTime.setEnabled(false); chkAutoLogoff.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (chkAutoLogoff.isSelected()) { tfLogoffTime.setEnabled(true); } else { tfLogoffTime.setEnabled(false); } } }); contentPanel.add(chkAutoLogoff, "newline"); //$NON-NLS-1$ contentPanel.add(new JLabel(Messages.getString("TerminalConfigurationView.16")), "split 2"); //$NON-NLS-1$ //$NON-NLS-2$ contentPanel.add(tfLogoffTime, "alignx left,grow,wrap"); //$NON-NLS-1$ contentPanel.add(new JLabel("Screen scaling")); //$NON-NLS-1$ tfScaleFactor = new DoubleTextField(5); contentPanel.add(tfScaleFactor); return contentPanel; }
From source file:SoundPlayer.java
JSlider createSlider(final FloatControl c) { if (c == null) return null; final JSlider s = new JSlider(0, 1000); final float min = c.getMinimum(); final float max = c.getMaximum(); final float width = max - min; float fval = c.getValue(); s.setValue((int) ((fval - min) / width * 1000)); java.util.Hashtable labels = new java.util.Hashtable(3); labels.put(new Integer(0), new JLabel(c.getMinLabel())); labels.put(new Integer(500), new JLabel(c.getMidLabel())); labels.put(new Integer(1000), new JLabel(c.getMaxLabel())); s.setLabelTable(labels);/*from w w w .j a va 2 s .com*/ s.setPaintLabels(true); s.setBorder(new TitledBorder(c.getType().toString() + " " + c.getUnits())); s.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { int i = s.getValue(); float f = min + (i * width / 1000.0f); c.setValue(f); } }); return s; }
From source file:lu.lippmann.cdb.common.gui.ts.TimeSeriesChartUtil.java
public static ChartPanel buildChartPanelForAllAttributes(final Instances dataSet, final boolean multAxis, final int dateIdx, final Color color, final Collection<XYAnnotation> annotations) { final TimeSeriesCollection tsDataset = new TimeSeriesCollection(); final JFreeChart tsChart = ChartFactory.createTimeSeriesChart("", "Time", "Value", tsDataset, true, true, false);//from w w w. j av a 2 s.c o m tsChart.getXYPlot().setBackgroundPaint(Color.WHITE); // optimized renderer to avoid to print all points tsChart.getXYPlot().setRenderer(new SamplingXYLineRenderer()); //tsChart.getXYPlot().setRenderer(new XYStepRenderer()); if (color == null) { for (int i = 0; i < dataSet.numAttributes() - 1; i++) { final String attrName = dataSet.attribute(i).name(); tsChart.getXYPlot().getRenderer().setSeriesPaint(i, ColorHelper.getColorForAString(attrName)); } } else { tsChart.getXYPlot().getRenderer().setSeriesPaint(0, color); } if (annotations != null) { for (final XYAnnotation aa : annotations) tsChart.getXYPlot().addAnnotation(aa); } if (multAxis) fillWithMultipleAxis(dataSet, dateIdx, tsDataset, tsChart); else fillWithSingleAxis(dataSet, dateIdx, tsDataset); final ChartPanel cp = new ChartPanel(tsChart, true); if (dataSet.numAttributes() <= 2) cp.setBorder(new TitledBorder(dataSet.attribute(0).name())); return cp; }
From source file:com.mirth.connect.client.ui.browsers.message.MessageBrowser.java
public void initComponentsManual() { attachmentPopupMenu = new JPopupMenu(); JMenuItem viewAttach = new JMenuItem("View Attachment"); viewAttach.setIcon(new ImageIcon(Frame.class.getResource("images/attach.png"))); viewAttach.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { viewAttachment();/*from w w w . j a v a 2 s .co m*/ } }); attachmentPopupMenu.add(viewAttach); JMenuItem exportAttach = new JMenuItem("Export Attachment"); exportAttach.setIcon(new ImageIcon(Frame.class.getResource("images/report_disk.png"))); exportAttach.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { exportAttachment(); } }); attachmentPopupMenu.add(exportAttach); pageSizeField.setDocument(new MirthFieldConstraints(3, false, false, true)); pageNumberField.setDocument(new MirthFieldConstraints(7, false, false, true)); advancedSearchPopup = new MessageBrowserAdvancedFilter(parent, this, "Advanced Search Filter", true, true); advancedSearchPopup.setVisible(false); LineBorder lineBorder = new LineBorder(new Color(0, 0, 0)); TitledBorder titledBorder = new TitledBorder("Current Search"); titledBorder.setBorder(lineBorder); lastSearchCriteriaPane.setBorder(titledBorder); lastSearchCriteriaPane.setBackground(Color.white); lastSearchCriteria.setBackground(Color.white); mirthDatePicker1.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent arg0) { allDayCheckBox.setEnabled(mirthDatePicker1.getDate() != null || mirthDatePicker2.getDate() != null); mirthTimePicker1.setEnabled(mirthDatePicker1.getDate() != null && !allDayCheckBox.isSelected()); } }); mirthDatePicker2.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent arg0) { allDayCheckBox.setEnabled(mirthDatePicker1.getDate() != null || mirthDatePicker2.getDate() != null); mirthTimePicker2.setEnabled(mirthDatePicker2.getDate() != null && !allDayCheckBox.isSelected()); } }); pageNumberField.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent arg0) { if (arg0.getKeyCode() == KeyEvent.VK_ENTER && pageGoButton.isEnabled()) { jumpToPageNumber(); } } }); if (!Arrays.asList("postgres", "oracle", "mysql").contains(PlatformUI.SERVER_DATABASE)) { regexTextSearchCheckBox.setEnabled(false); } this.addAncestorListener(new AncestorListener() { @Override public void ancestorAdded(AncestorEvent event) { } @Override public void ancestorMoved(AncestorEvent event) { } @Override public void ancestorRemoved(AncestorEvent event) { // Stop waiting for message browser requests when the message browser // is no longer being displayed parent.mirthClient.getServerConnection().abort(getAbortOperations()); // Clear the message cache when leaving the message browser. parent.messageBrowser.clearCache(); // Clear the table selection to prevent the selection listener from triggering multiple times while the model is being cleared deselectRows(); // Clear the records in the table tableModel.clear(); // Remove all columns for (TableColumn tableColumn : messageTreeTable.getColumns(true)) { messageTreeTable.removeColumn(tableColumn); } } }); }
From source file:SoundPlayer.java
void addMidiControls() { // Add a slider to control the tempo final JSlider tempo = new JSlider(50, 200); tempo.setValue((int) (sequencer.getTempoFactor() * 100)); tempo.setBorder(new TitledBorder("Tempo Adjustment (%)")); java.util.Hashtable labels = new java.util.Hashtable(); labels.put(new Integer(50), new JLabel("50%")); labels.put(new Integer(100), new JLabel("100%")); labels.put(new Integer(200), new JLabel("200%")); tempo.setLabelTable(labels);// w w w . j a va 2 s .co m tempo.setPaintLabels(true); // The event listener actually changes the tmpo tempo.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { sequencer.setTempoFactor(tempo.getValue() / 100.0f); } }); this.add(tempo); // Create rows of solo and checkboxes for each track Track[] tracks = sequence.getTracks(); for (int i = 0; i < tracks.length; i++) { final int tracknum = i; // Two checkboxes per track final JCheckBox solo = new JCheckBox("solo"); final JCheckBox mute = new JCheckBox("mute"); // The listeners solo or mute the track solo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { sequencer.setTrackSolo(tracknum, solo.isSelected()); } }); mute.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { sequencer.setTrackMute(tracknum, mute.isSelected()); } }); // Build up a row Box box = Box.createHorizontalBox(); box.add(new JLabel("Track " + tracknum)); box.add(Box.createHorizontalStrut(10)); box.add(solo); box.add(Box.createHorizontalStrut(10)); box.add(mute); box.add(Box.createHorizontalGlue()); // And add it to this component this.add(box); } }
From source file:lu.lippmann.cdb.lab.mds.UniversalMDS.java
public JXPanel buildMDSViewFromDataSet(Instances ds, MDSTypeEnum type) throws Exception { final XYSeriesCollection dataset = new XYSeriesCollection(); final JFreeChart chart = ChartFactory.createScatterPlot("", // title "X", "Y", // axis labels dataset, // dataset PlotOrientation.VERTICAL, true, // legend? yes true, // tooltips? yes false // URLs? no );/*from ww w . j av a2 s . co m*/ final XYPlot xyPlot = (XYPlot) chart.getPlot(); chart.setTitle(type.name() + " MDS"); Attribute clsAttribute = null; int nbClass = 1; if (ds.classIndex() != -1) { clsAttribute = ds.classAttribute(); nbClass = clsAttribute.numValues(); } final List<XYSeries> lseries = new ArrayList<XYSeries>(); if (nbClass <= 1) { lseries.add(new XYSeries("Serie #1", false)); } else { for (int i = 0; i < nbClass; i++) { lseries.add(new XYSeries(clsAttribute.value(i), false)); } } dataset.removeAllSeries(); /** * Initialize filtered series */ final List<Instances> filteredInstances = new ArrayList<Instances>(); for (int i = 0; i < lseries.size(); i++) { filteredInstances.add(new Instances(ds, 0)); } for (int i = 0; i < ds.numInstances(); i++) { final Instance oInst = ds.instance(i); int indexOfSerie = 0; if (oInst.classIndex() != -1) { indexOfSerie = (int) oInst.value(oInst.classAttribute()); } lseries.get(indexOfSerie).add(coordinates[i][0], coordinates[i][1]); filteredInstances.get(indexOfSerie).add(oInst); } final List<Paint> colors = new ArrayList<Paint>(); for (final XYSeries series : lseries) { dataset.addSeries(series); } final XYToolTipGenerator gen = new XYToolTipGenerator() { @Override public String generateToolTip(XYDataset dataset, int series, int item) { return InstanceFormatter.htmlFormat(filteredInstances.get(series).instance(item), true); } }; final Shape shape = new Ellipse2D.Float(0f, 0f, 5f, 5f); ((XYLineAndShapeRenderer) xyPlot.getRenderer()).setUseOutlinePaint(true); for (int p = 0; p < nbClass; p++) { xyPlot.getRenderer().setSeriesToolTipGenerator(p, gen); ((XYLineAndShapeRenderer) xyPlot.getRenderer()).setLegendShape(p, shape); xyPlot.getRenderer().setSeriesOutlinePaint(p, Color.BLACK); } for (int ii = 0; ii < nbClass; ii++) { colors.add(xyPlot.getRenderer().getItemPaint(ii, 0)); } final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setMouseWheelEnabled(true); chartPanel.setPreferredSize(new Dimension(1200, 900)); chartPanel.setBorder(new TitledBorder("MDS Projection")); chartPanel.setBackground(Color.WHITE); final JXPanel allPanel = new JXPanel(); allPanel.setLayout(new BorderLayout()); allPanel.add(chartPanel, BorderLayout.CENTER); return allPanel; }
From source file:edu.clemson.cs.nestbed.client.gui.TestbedManagerFrame.java
private final JPanel buildConfigurationPanel() { JPanel configPanel = new JPanel(new BorderLayout()); configPanel.setBorder(new TitledBorder("Configurations")); // --- left-side ------------------------------------------------- JPanel sidePanel = new JPanel(new BorderLayout()); sidePanel.setPreferredSize(new Dimension(WINDOW_WIDTH / 3, SIZE_IGNORED)); configurationList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); configurationList.addListSelectionListener(new ConfigListSelectionListener()); sidePanel.add(new JScrollPane(configurationList), BorderLayout.CENTER); configPanel.add(sidePanel, BorderLayout.WEST); // --- right-side ------------------------------------------------ sidePanel = new JPanel(new BorderLayout()); sidePanel.setPreferredSize(new Dimension(310, SIZE_IGNORED)); JPanel rsTopPanel = new JPanel(new BorderLayout()); rsTopPanel.setPreferredSize(new Dimension(SIZE_IGNORED, 50)); JPanel labelPanel = new JPanel(new GridLayout(2, 1, 0, 5)); labelPanel.add(new JLabel("Name: ")); labelPanel.add(new JLabel("Description: ")); JPanel infoPanel = new JPanel(new GridLayout(2, 1, 0, 5)); infoPanel.add(configurationName);//from w w w .ja v a2 s .co m configurationName.setEditable(false); infoPanel.add(configurationDesc); configurationDesc.setEditable(false); rsTopPanel.add(labelPanel, BorderLayout.WEST); rsTopPanel.add(infoPanel, BorderLayout.CENTER); sidePanel.add(rsTopPanel, BorderLayout.NORTH); configPanel.add(sidePanel, BorderLayout.EAST); return configPanel; }
From source file:aplicarFiltros.PanelResultado.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner Evaluation license - Sebastian Colavita DefaultComponentFactory compFactory = DefaultComponentFactory.getInstance(); panel2 = new JPanel(); panel1 = new JPanel(); scrollPaneRasgos2 = new JScrollPane(); tableRasgos2 = new JTable(); button1 = new JButton(); separator1 = compFactory.createSeparator("Clasificaci\u00f3n"); label1 = new JLabel(); resultado = new JLabel(); label2 = new JLabel(); Descuento = new JLabel(); panel3 = new JPanel(); panelGraficoPixel = new JPanel(); //======== this ======== // JFormDesigner evaluation mark setBorder(/*from w w w . j ava2s .co m*/ new javax.swing.border.CompoundBorder( new javax.swing.border.TitledBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0), "JFormDesigner Evaluation", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.BOTTOM, new java.awt.Font("Dialog", java.awt.Font.BOLD, 12), java.awt.Color.red), getBorder())); addPropertyChangeListener(new java.beans.PropertyChangeListener() { public void propertyChange(java.beans.PropertyChangeEvent e) { if ("border".equals(e.getPropertyName())) throw new RuntimeException(); } }); setLayout(null); //======== panel2 ======== { panel2.setBackground(Color.blue); panel2.setLayout(null); //======== panel1 ======== { panel1.setBorder(new BevelBorder(BevelBorder.RAISED)); panel1.setLayout(null); //======== scrollPaneRasgos2 ======== { //---- tableRasgos2 ---- tableRasgos2.setModel(new DefaultTableModel(new Object[][] {}, new String[] { "Clasificaciones", "Cantidad", "Porcentaje Area" }) { Class<?>[] columnTypes = new Class<?>[] { String.class, String.class, Object.class }; @Override public Class<?> getColumnClass(int columnIndex) { return columnTypes[columnIndex]; } }); tableRasgos2.setPreferredScrollableViewportSize(new Dimension(200, 100)); tableRasgos2.setBackground(UIManager.getColor("RadioButton.light")); tableRasgos2.setCellSelectionEnabled(true); scrollPaneRasgos2.setViewportView(tableRasgos2); } panel1.add(scrollPaneRasgos2); scrollPaneRasgos2.setBounds(10, 60, 605, 155); //---- button1 ---- button1.setIcon(new ImageIcon("\\\\img\\\\maiz_mon810_al.jpg")); panel1.add(button1); button1.setBounds(620, 60, 225, 155); panel1.add(separator1); separator1.setBounds(10, 5, 835, separator1.getPreferredSize().height); //---- label1 ---- label1.setText("Resultado:"); label1.setFont(new Font("Times New Roman", Font.BOLD, 13)); panel1.add(label1); label1.setBounds(10, 35, 67, label1.getPreferredSize().height); //---- resultado ---- resultado.setText("Grado A"); resultado.setFont(new Font("Times New Roman", Font.BOLD, 13)); resultado.setForeground(Color.blue); panel1.add(resultado); resultado.setBounds(79, 35, 171, 19); //---- label2 ---- label2.setText(" Descuento:"); label2.setFont(new Font("Times New Roman", Font.BOLD, 13)); panel1.add(label2); label2.setBounds(250, 35, 72, 19); //---- Descuento ---- Descuento.setText("10%"); Descuento.setFont(new Font("Times New Roman", Font.BOLD, 13)); Descuento.setForeground(Color.blue); panel1.add(Descuento); Descuento.setBounds(320, 35, 60, Descuento.getPreferredSize().height); { // compute preferred size Dimension preferredSize = new Dimension(); for (int i = 0; i < panel1.getComponentCount(); i++) { Rectangle bounds = panel1.getComponent(i).getBounds(); preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width); preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height); } Insets insets = panel1.getInsets(); preferredSize.width += insets.right; preferredSize.height += insets.bottom; panel1.setMinimumSize(preferredSize); panel1.setPreferredSize(preferredSize); } } panel2.add(panel1); panel1.setBounds(15, 10, 856, 225); //======== panel3 ======== { panel3.setBorder(new TitledBorder("Gr\u00e1ficos")); panel3.setLayout(new BoxLayout(panel3, BoxLayout.Y_AXIS)); //======== panelGraficoPixel ======== { panelGraficoPixel.setLayout(null); { // compute preferred size Dimension preferredSize = new Dimension(); for (int i = 0; i < panelGraficoPixel.getComponentCount(); i++) { Rectangle bounds = panelGraficoPixel.getComponent(i).getBounds(); preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width); preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height); } Insets insets = panelGraficoPixel.getInsets(); preferredSize.width += insets.right; preferredSize.height += insets.bottom; panelGraficoPixel.setMinimumSize(preferredSize); panelGraficoPixel.setPreferredSize(preferredSize); } } panel3.add(panelGraficoPixel); } panel2.add(panel3); panel3.setBounds(13, 245, 857, 355); { // compute preferred size Dimension preferredSize = new Dimension(); for (int i = 0; i < panel2.getComponentCount(); i++) { Rectangle bounds = panel2.getComponent(i).getBounds(); preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width); preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height); } Insets insets = panel2.getInsets(); preferredSize.width += insets.right; preferredSize.height += insets.bottom; panel2.setMinimumSize(preferredSize); panel2.setPreferredSize(preferredSize); } } add(panel2); panel2.setBounds(10, 5, 883, 610); { // compute preferred size Dimension preferredSize = new Dimension(); for (int i = 0; i < getComponentCount(); i++) { Rectangle bounds = getComponent(i).getBounds(); preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width); preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height); } Insets insets = getInsets(); preferredSize.width += insets.right; preferredSize.height += insets.bottom; setMinimumSize(preferredSize); setPreferredSize(preferredSize); } // JFormDesigner - End of component initialization //GEN-END:initComponents button1.setIcon(new ImageIcon("img\\maiz_mon810_al.jpg")); }
From source file:es.emergya.ui.gis.popups.ConsultaHistoricos.java
private JPanel getElementos() { JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEADING)); panel.setOpaque(false);//from w ww. j av a 2 s .co m panel.setBorder(new TitledBorder("Elementos a Consultar")); JLabel jLabel = new JLabel("Recursos", SwingConstants.RIGHT); jLabel.setPreferredSize(ConsultaHistoricos.DIMENSION_LABEL); panel.add(jLabel); recursos = new JList(new DefaultListModel()); recursos.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.CTRL_MASK), "selectAll"); recursos.getActionMap().put("selectAll", new AbstractAction() { private static final long serialVersionUID = -5515338515763292526L; @Override public void actionPerformed(ActionEvent e) { recursos.setSelectionInterval(0, recursos.getModel().getSize() - 1); } }); recursos.addListSelectionListener(listSelectionListener); final JScrollPane jScrollPaneR = new JScrollPane(recursos, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); jScrollPaneR.getViewport().setPreferredSize(DIMENSION_JLIST); panel.add(jScrollPaneR); jLabel = new JLabel("Incidencias", SwingConstants.RIGHT); jLabel.setPreferredSize(ConsultaHistoricos.DIMENSION_LABEL); panel.add(jLabel); incidencias = new JList(new DefaultListModel()); incidencias.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.CTRL_MASK), "selectAll"); incidencias.getActionMap().put("selectAll", new AbstractAction() { private static final long serialVersionUID = -5515338515763292526L; @Override public void actionPerformed(ActionEvent e) { incidencias.setSelectionInterval(0, incidencias.getModel().getSize() - 1); } }); incidencias.addListSelectionListener(listSelectionListener); final JScrollPane jScrollPaneI = new JScrollPane(incidencias, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); jScrollPaneI.getViewport().setPreferredSize(DIMENSION_JLIST); panel.setPreferredSize(DIMENSION_2JLIST); panel.add(jScrollPaneI); return panel; }