All pastes #12577 Raw Edit

Miscellany

public java v1 · immutable
#12577 ·published 2005-05-25 03:29 UTC
rendered paste body
//a picture of this app running is available here://http://www.geocities.com/aiyaiyairc/fileio.gifimport javax.swing.*;import java.awt.*;import java.awt.event.*;public class TestingTop extends JFrame{       private Container container;  //  private GridBagLayout layout;   // private GridBagConstraints constraints;     private BorderLayout layout;       private JLabel adder, remover;        private JPanel controls, listHolder;        String label [] = {"Cranberry", "Orange",     "Banana", "Kiwi", "Blueberry",     "Pomegranate", "Apple", "Pear",     "Watermelon", "Raspberry", "Snozberry"  };    public TestingTop() {        super("File IO Thingy");        container = getContentPane();        //layout = new GridBagLayout();        layout = new BorderLayout();        container.setLayout( layout );           //setLayout( layout );        container.setBackground(Color.black);                buildControls();        buildListPanel();                        container.add(controls, BorderLayout.NORTH);          container.add(listHolder, BorderLayout.SOUTH);                         setSize( 300, 350 );        setVisible( true );    }        ////////////////////////////////////////////////////////////////////////////////////////    ////////////////////////////////////  ////////////////////////////////////////////////////////////////////////////////////////    private void buildControls()        {                 controls = new JPanel();          controls.setBackground(Color.black);                //add button        Icon adderI = new ImageIcon("C:/j2sdk1.4.2_04/5netbeans/Juke/src/juke/images/add.gif");        adder = new JLabel(adderI);        //remove button        Icon removerI = new ImageIcon("C:/j2sdk1.4.2_04/5netbeans/Juke/src/juke/images/remove.gif");        remover = new JLabel(removerI);                        controls.add(adder);        controls.add(remover);              }  ////////////////////////////////////////////////////////////////////////////////////////    ////////////////////////////////////  ////////////////////////////////////////////////////////////////////////////////////////                   ////////////////////////////////////////////////////////////////////////////////////////    ////////////////////////////////////  ////////////////////////////////////////////////////////////////////////////////////////        private void buildListPanel()        {                 listHolder = new JPanel();        listHolder.setBackground(Color.white);        listHolder.setBorder(BorderFactory.createTitledBorder("The Filelist"));        JList jList1 = new JList( label );                JScrollPane pane = new JScrollPane(jList1);       // listHolder.add(jList1);         listHolder.add(pane);        }  ////////////////////////////////////////////////////////////////////////////////////////    ////////////////////////////////////  ////////////////////////////////////////////////////////////////////////////////////////                    public static void main(String args[]) { 	   TestingTop f = new TestingTop();           f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);     }    }