/* * Statistics.java * * Created on November 20, 2007, 12:10 AM */ import java.awt.*; // Layouts, I hope import javax.swing.*; // Everything else, I hope /** * * @author Danu */ public class Statistics extends javax.swing.JFrame { /** Creates new form Statistics */ public Statistics() { initComponents(); } /** 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() { jLabel1 = new javax.swing.JLabel(); jComboBox1 = new javax.swing.JComboBox(); jRadioButton1 = new javax.swing.JRadioButton(); jRadioButton2 = new javax.swing.JRadioButton(); jScrollPane1 = new javax.swing.JScrollPane(); jTable1 = new javax.swing.JTable(); // Alignment, size jLabel1.setAlignmentX(Component.CENTER_ALIGNMENT); jComboBox1.setAlignmentX(Component.CENTER_ALIGNMENT); jComboBox1.setPreferredSize(new Dimension(69, 23)); jRadioButton1.setAlignmentX(Component.CENTER_ALIGNMENT); jRadioButton2.setAlignmentX(Component.CENTER_ALIGNMENT); jScrollPane1.setAlignmentX(Component.CENTER_ALIGNMENT); jTable1.setAlignmentX(Component.CENTER_ALIGNMENT); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Grades"); jLabel1.setText("mhayes"); jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Quiz 1", "Quiz 2", "Quiz 3", "Quiz 4" })); jRadioButton1.setText("Table View"); jRadioButton1.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); jRadioButton1.setMargin(new java.awt.Insets(0, 0, 0, 0)); jRadioButton2.setText("Graph View"); jRadioButton2.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); jRadioButton2.setMargin(new java.awt.Insets(0, 0, 0, 0)); jTable1.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null, null, null}, {null, null, null, null}, {null, null, null, null}, {null, null, null, null} }, new String [] { "Title 1", "Title 2", "Title 3", "Title 4" } )); jScrollPane1.setViewportView(jTable1); // Begin Group madness /* javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(170, 170, 170) .addComponent(jLabel1)) .addGroup(layout.createSequentialGroup() .addGap(162, 162, 162) .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addGap(122, 122, 122) .addComponent(jRadioButton1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jRadioButton2)) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 375, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(15, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel1) .addGap(21, 21, 21) .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(25, 25, 25) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jRadioButton2) .addComponent(jRadioButton1)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 17, Short.MAX_VALUE) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 373, javax.swing.GroupLayout.PREFERRED_SIZE)) ); */ JPanel top = new JPanel(); top.setLayout(new BoxLayout(top, BoxLayout.Y_AXIS)); top.add(jLabel1); top.add(jComboBox1); JPanel radio = new JPanel(); radio.setLayout(new BoxLayout(radio, BoxLayout.X_AXIS)); ButtonGroup group = new ButtonGroup(); group.add(jRadioButton1); group.add(jRadioButton2); radio.add(jRadioButton1); radio.add(Box.createRigidArea( new Dimension(10, 0))); radio.add(jRadioButton2); top.add(radio); top.add(jTable1); this.getContentPane().add(top); /* Container myPanel = this.getContentPane(); myPanel.setLayout(new BorderLayout(11, 11)); myPanel.add(top, BorderLayout.NORTH); myPanel.add(jTable1, BorderLayout.CENTER); */ pack(); //setSize(new Dimension(400, 500)); }// //GEN-END:initComponents /** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Statistics().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JComboBox jComboBox1; private javax.swing.JLabel jLabel1; private javax.swing.JRadioButton jRadioButton1; private javax.swing.JRadioButton jRadioButton2; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTable jTable1; // End of variables declaration//GEN-END:variables }