import javax.swing.*; import com.sun.j3d.utils.universe.*; import java.awt.*; public class ZSBEditor extends JPanel { private JTextArea config = new JTextArea(); private JTextArea console = new JTextArea(); private JPanel controller = new JPanel(); private ZSBScreen screen; public ZSBEditor(ZSBScreen screen) { this.screen = screen; /// setup default colors Color c1 = new Color(.23f, .23f, .23f); Color c2 = new Color(1.0f, 1.0f, 1.0f); Font f1 = new Font("Monospaced", Font.PLAIN, 12); /// setup console console.setBackground(c1); console.setForeground(c2); console.setFont(f1); console.setText( "Course : Search, Navigate and Actuate\n" + "Project: JointVenture theta version \n" + "Authors: Lennard Kuijten and Jules van Velzen\n\n" + "Enter configuration in following format:\n" + "theta d a alpha type min max var\n" ); /// text config config.setBackground(c2); config.setForeground(c1); config.setFont(f1); /// set layout this.setLayout(new BorderLayout()); JTabbedPane tp = new JTabbedPane(); tp.addTab("Config", getConfigPanel()); tp.addTab("Control", getControlPanel()); //this.add("North", new JLabel(" theta d a alpha type min max var ")); this.add(tp); } public JPanel getControlPanel() { JButton refresh = new JButton("refresh"); JPanel tab = new JPanel(); tab.setLayout(new BorderLayout()); refresh.addActionListener(new CommandShowPanels(tab, screen)); tab.add("North", refresh); return tab; } public JPanel getConfigPanel() { JPanel tab = new JPanel(); tab.setLayout(new BorderLayout()); //// CENTER layout JPanel center = new JPanel(); center.setLayout(new GridLayout(2,1)); center.add(console); center.add(config); /// SOUTH layout JPanel south = new JPanel(); south.setLayout(new GridLayout(2,2)); /// button: set JButton dhset = new JButton("Set"); dhset.addActionListener( new CommandSetJoints(config, screen, console) ); south.add(dhset); /// button: add JButton dhadd = new JButton("Add"); dhadd.addActionListener( new CommandAddJoints(config, screen, console) ); south.add(dhadd); /// button: umi JButton dhgetumi = new JButton("Get UmiRTX"); dhgetumi.addActionListener( new CommandGetUmiRTX(config, screen, console) ); south.add(dhgetumi); /// button: puma JButton dhgetpuma = new JButton("Get Puma"); dhgetpuma.addActionListener( new CommandGetPuma(config, screen, console) ); south.add(dhgetpuma); /// add to borderlayout tab.add("Center", center); tab.add("South", south); return tab; } public String getText() { return this.config.getText(); } }