public Animation() { String[] keys = {"no Animator found"}; if (tryDir(".")) // || tryDir("BLM305") || tryDir("CSE470")) keys = map.keySet().toArray(keys); System.out.println(map.size() + " classes loaded"); menu = new JComboBox(keys); pan.setLayout(new BorderLayout(GAP, GAP - 4)); pan.setBorder(new javax.swing.border.EmptyBorder(GAP, GAP, GAP, GAP)); pan.setBackground(COLOR); last = new JPanel(); last.setPreferredSize(DIM); pan.add(last, "Center"); ref.setFont(NORM); ref.setEditable(false); ref.setColumns(35); ref.setDragEnabled(true); pan.add(ref, "North"); pan.add(bottomPanel(), "South"); pan.setToolTipText("A collective project for BLM320"); menu.setToolTipText("Animator classes"); who.setToolTipText("author()"); ref.setToolTipText("description()"); Closer ear = new Closer(); menu.addActionListener(ear); stop.addActionListener(ear); frm.addWindowListener(ear); if (map.size() > 0) setItem(0); frm.setContentPane(pan); frm.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frm.setLocation(scaled(120), scaled(90)); frm.pack(); // setSize() is called here frm.setVisible(true); start(); }
/** Creates a ComponentTree, loading the Components from the file at <code>path</code>. */ public ComponentTree(String path) { this.path = path; ttCount++; jTextArea = new JTextArea(); textArea = new JTextArea(); redirectSystemStreams(); frame = createFrame(); Container cPane = frame.getContentPane(); JMenuBar mb = createMenuBar(); TreeTableModel model = createModel(path); cPane.setLayout(new BorderLayout(5, 5)); Dimension dim = new Dimension(600, 600); cPane.setPreferredSize(dim); try { textArea.read(new FileReader(path), null); } catch (IOException e) { e.printStackTrace(); // To change body of catch statement use File | Settings | File // Templates. } treeTable = createTreeTable(model); textArea.setEditable(false); JScrollPane tp = new JScrollPane( textArea, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); JScrollPane sp = new JScrollPane( treeTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); JScrollPane cp = new JScrollPane( jTextArea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); sp.getViewport().setBackground(Color.white); Dimension scrDim = new Dimension(300, 600); Dimension dime = new Dimension(300, 400); Dimension dimc = new Dimension(300, 200); sp.setLocation(0, 0); sp.setPreferredSize(dime); tp.setLocation(300, 0); tp.setPreferredSize(scrDim); cp.setLocation(0, 400); cp.setPreferredSize(dimc); cPane.add(sp, BorderLayout.LINE_START); cPane.add(tp, BorderLayout.CENTER); cPane.add(cp, BorderLayout.PAGE_END); cPane.setPreferredSize(dim); // frame.add(cPane); frame.setJMenuBar(mb); // frame.pack(); frame.setVisible(true); }