test.ScrollPaneTest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Quaqua Show documentation
Show all versions of Quaqua Show documentation
A Mavenisation of the Quaqua Mac OSX Swing Look and Feel (Java library)
Quaqua Look and Feel (C) 2003-2010, Werner Randelshofer.
Mavenisation by Matt Gumbley, DevZendo.org - for problems with
Mavenisation, see Matt; for issues with Quaqua, see the Quaqua home page.
For full license details, see http://randelshofer.ch/quaqua/license.html
The newest version!
/*
* @(#)ScrollPaneTest.java 1.0 August 25, 2005
*
* Copyright (c) 2005 Werner Randelshofer, Immensee, Switzerland.
* All rights reserved.
*
* You may not use, copy or modify this file, except in compliance with the
* license agreement you entered into with Werner Randelshofer.
* For details see accompanying license terms.
*/
package test;
import java.util.*;
import javax.swing.*;
import java.security.*;
/**
* ScrollPaneTest.
*
* @author Werner Randelshofer
* @version 1.0 August 25, 2005 Created.
*/
public class ScrollPaneTest extends javax.swing.JPanel {
/**
* Creates a new instance.
*/
public ScrollPaneTest() {
initComponents();
DefaultListModel lm = new DefaultListModel();
for (int i=1; i <= 100; i++) {
lm.addElement(i);
}
jList1.setModel(lm);
jScrollPane2.getViewport().setOpaque(false);
/*
jScrollPane2.setFont(new Font("Lucida Grande", Font.PLAIN, 11));
*/
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
final long start = System.currentTimeMillis();
final java.util.List argList = Arrays.asList(args);
// Explicitly turn on font antialiasing.
try {
System.setProperty("swing.aatext", "true");
} catch (AccessControlException e) {
// can't do anything about this
}
// Launch the test program
SwingUtilities.invokeLater(new Runnable() {
public void run() {
int index = argList.indexOf("-laf");
if (index != -1 && index < argList.size() - 1) {
try {
UIManager.setLookAndFeel((String) argList.get(index + 1));
} catch (Exception e) {
// can't do anything about this
}
} else {
try {
UIManager.setLookAndFeel("ch.randelshofer.quaqua.QuaquaLookAndFeel");
} catch (Exception e) {
// can't do anything about this
}
}
JComponent c = new ScrollPaneTest();
JFrame f = new JFrame("ScrollPaneTest");
f.getContentPane().add(c);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.pack();
f.setVisible(true);
long end = System.currentTimeMillis();
System.out.println("QuaquaTest total startup latency="+(end - start));
}
});
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// //GEN-BEGIN:initComponents
private void initComponents() {
java.awt.GridBagConstraints gridBagConstraints;
jScrollPane1 = new javax.swing.JScrollPane();
jScrollPane2 = new javax.swing.JScrollPane();
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
jCheckBox1 = new javax.swing.JCheckBox();
jLabel3 = new javax.swing.JLabel();
jComboBox1 = new javax.swing.JComboBox();
jLabel4 = new javax.swing.JLabel();
jTextField2 = new javax.swing.JTextField();
jScrollPane4 = new javax.swing.JScrollPane();
jPanel2 = new javax.swing.JPanel();
jScrollPane3 = new javax.swing.JScrollPane();
jList1 = new javax.swing.JList();
setBorder(javax.swing.BorderFactory.createEmptyBorder(16, 17, 17, 17));
setLayout(new java.awt.GridBagLayout());
jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
jScrollPane1.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
jScrollPane1.setPreferredSize(new java.awt.Dimension(100, 100));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridy = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
add(jScrollPane1, gridBagConstraints);
jScrollPane2.setPreferredSize(new java.awt.Dimension(100, 100));
jPanel1.setLayout(new java.awt.GridBagLayout());
jLabel1.setText("jLabel1");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
jPanel1.add(jLabel1, gridBagConstraints);
jTextField1.setText("jTextField1");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = new java.awt.Insets(0, 6, 0, 0);
jPanel1.add(jTextField1, gridBagConstraints);
jLabel2.setText("jLabel2");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridy = 1;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
jPanel1.add(jLabel2, gridBagConstraints);
jCheckBox1.setText("jCheckBox1");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridy = 1;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = new java.awt.Insets(0, 6, 0, 0);
jPanel1.add(jCheckBox1, gridBagConstraints);
jLabel3.setText("jLabel3");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridy = 2;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
jPanel1.add(jLabel3, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridy = 2;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = new java.awt.Insets(0, 6, 0, 0);
jPanel1.add(jComboBox1, gridBagConstraints);
jLabel4.setText("jLabel4");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridy = 3;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
jPanel1.add(jLabel4, gridBagConstraints);
jTextField2.setText("jTextField2");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridy = 3;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = new java.awt.Insets(0, 6, 0, 0);
jPanel1.add(jTextField2, gridBagConstraints);
jScrollPane2.setViewportView(jPanel1);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridy = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
add(jScrollPane2, gridBagConstraints);
jScrollPane4.setPreferredSize(new java.awt.Dimension(100, 100));
jScrollPane4.setViewportView(jPanel2);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridy = 1;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
add(jScrollPane4, gridBagConstraints);
jScrollPane3.setPreferredSize(new java.awt.Dimension(100, 100));
jList1.setModel(new javax.swing.AbstractListModel() {
String[] strings = { "The quick brown fox jumps over the lazy dog.", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen" };
public int getSize() { return strings.length; }
public Object getElementAt(int i) { return strings[i]; }
});
jScrollPane3.setViewportView(jList1);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridy = 1;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
add(jScrollPane3, gridBagConstraints);
}// //GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JCheckBox jCheckBox1;
private javax.swing.JComboBox jComboBox1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JList jList1;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JScrollPane jScrollPane4;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
// End of variables declaration//GEN-END:variables
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy