All pastes #955334 Raw Edit

kestaz

public java v1 · immutable
#955334 ·published 2008-03-24 15:38 UTC
rendered paste body
/* * Main.java * * Created on March 24, 2008, 12:31 PM * * To change this template, choose Tools | Template Manager * and open the template in the editor. */package programa;import java.awt.* ; import java.util.Vector;import javax.swing.* ;import javax.swing.table.AbstractTableModel;public class Main {    public static void main(String[] args) {                JFrame window = new App() ;         window.setVisible(true);            }}class App extends JFrame  {       protected JTable table ;     protected JMenuBar menuBar ;     protected JMenu menu, submenu, aboutMenu ;     protected JMenuItem menuItem ;    protected JLabel statusBar ;         protected JButton addButton ;     protected JButton deleteButton ;         protected InteractiveTabelModel tableModel ;     public String[] columnNames = { "Title", "Artist", "Year" }  ;       c.fill = GridBagConstraints.VERTICAL ;         App()    {        Container content = getContentPane() ;         //JPanel content  = new JPanel() ;        // setContentPane(content);        setTitle("Tiny CD Database v.0.0.1") ;        setSize(400, 200) ;         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);        content.setLayout(new BorderLayout());                            //    tableModel = new InteractiveTabelModel(columnNames) ;                 table = new JTable() ;       //  table.setModel(tableModel) ;              //   tableModel.addToModel("NIRVANA", "You Know You're Right", 2002) ;       //  tableModel.addToModel("The Beatles", "Let it be... Naked", 2003) ;                                         menuBar = new JMenuBar() ;                 menu  = new JMenu("File") ;                 aboutMenu = new JMenu("Help") ;                 menuBar.add(menu) ;                 menuBar.add(aboutMenu) ;                 menuItem = new JMenuItem("Save") ;                 menu.add(menuItem)  ;                        statusBar = new JLabel("Tiny CD Database v.0.0.1") ;         JPanel rightPanel = new JPanel() ;         JScrollPane scrollPane = new JScrollPane(table) ;         table.setFillsViewportHeight(true);           //content.add(table, BorderLayout.CENTER) ;         //content.add(table.getTableHeader(), BorderLayout.PAGE_START) ;         content.add(statusBar, BorderLayout.PAGE_END) ;                 content.add(scrollPane, BorderLayout.CENTER) ;              //  rightPanel.setLayout(new BoxLayout(rightPanel, BoxLayout.PAGE_AXIS) ) ;                         addButton = new JButton("Add CD") ;         deleteButton = new JButton("Delete CD") ;                 rightPanel.setLayout(new GridBagLayout())  ;                GridBagConstraints c = new GridBagConstraints() ;                 //rightPanel.setLayout(new BoxLayout(rightPanel, BoxLayout.PAGE_AXIS)) ;                c.fill = GridBagConstraints.VERTICAL ;         c.gridx = 0 ;        c.gridy = 0 ;           rightPanel.add(addButton, c) ;         c.gridy = 1 ;        rightPanel.add(deleteButton,c) ;          ///rightPanel.add(deleteButton) ;        //c.gridy = 1 ;        // rightPanel.add(deleteButton) ;         //content.add(testButton, BorderLayout.CENTER)         content.add(rightPanel, BorderLayout.LINE_END) ;                setJMenuBar(menuBar) ;     }            }