Results 1 to 3 of 3

Thread: DERS Interface

  1. #1
    Floetic's Avatar
    Floetic is offline Member
    Join Date
    Feb 2008
    Location
    Belfast, Northern Ireland, UK
    Posts
    8
    Rep Power
    0

    Question DERS Interface

    Hey There,

    I have wrote some java code below (using NetBeans IDE 6.0.1) for a graphical user interface. When I open the JavaApplication7 Executable Jar File from the JavaApplication7 Project Folder I created (C:\JavaApplication7\dist\JavaApplication7.jar) to run the interface.

    I notice that the text fields and the text area seem to jump downwards a little, does anyone know what might be the cause of this?


    This is the code:


    Java Code:
    package newpackage7;
    
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    //import javax.swing.JOptionPane;
    
    public class NewClass7 extends javax.swing.JFrame{
        
        public NewClass7() {
            //prolog.loadProlog("",0,1);
            initiateComponents();        
        }//end constructuor NewClass7()
        
        //declare interface properties
        //public final LpaIS prolog=new LpaIS();
        /*public String GlobalCheckSyntaxFile="";
         * public String GlobalEditFile="";
         * public String GlobalLoadFile="";
         * public final LpaIS CheckSynatxProlog=new LpaIS(); */
        
        private javax.swing.JPanel innerPanel;
        
        private javax.swing.JMenuBar MainMenuBar;
          
        private javax.swing.JMenu FileMenu;
        private javax.swing.JMenuItem NewScenarioMenuItem;
        private javax.swing.JMenuItem OpenScenarioMenuItem;
        private javax.swing.JMenuItem SaveScenarioMenuItem;
        private javax.swing.JMenuItem ClearOutputWindowMenuItem;
        private javax.swing.JMenuItem ExitMenuItem;
        
        private javax.swing.JMenu ScenarioMenu;
        private javax.swing.JMenuItem EditScenarioMenuItem;
        private javax.swing.JMenuItem CheckSyntaxScenarioMenuItem;
        private javax.swing.JMenuItem OpenScenarioGeneratorMenuItem;
        
        private javax.swing.JMenu RunMenu;
        private javax.swing.JMenuItem RunSimulationMenuItem;
        private javax.swing.JMenuItem MakeQueryMenuItem;
        
        private javax.swing.JMenu HelpMenu;
        private javax.swing.JMenuItem ReadMeMenuItem;
        private javax.swing.JMenuItem AboutMenuItem;
        
        private javax.swing.JLabel TitleLabel;
        
        private javax.swing.JLabel AlgorithmLabel;
        private javax.swing.JLabel ScenarioLabel;
        private javax.swing.JLabel GoalLabel;
        private javax.swing.JLabel TimeLabel;
        private javax.swing.JLabel PredicateLabel;
        
        private java.awt.TextField AlgorithmTextField;
        private java.awt.TextField ScenarioTextField;
        private java.awt.TextField GoalTextField;
        private java.awt.TextField TimeTextField;
        private java.awt.TextField PredicateTextField;
        
        private javax.swing.JButton SearchButton;
        private javax.swing.JButton HoldsButton;
        
        private java.awt.TextArea OutputWindow;
        
        private void initiateComponents() {
            getContentPane().setLayout(null);
            setTitle("Dynamic Environment Reasoning System");
            setSize(new Dimension(1025, 703));
            setResizable(false);
            setDefaultCloseOperation(NewClass7.EXIT_ON_CLOSE);
            //getContentPane().setBackground(new java.awt.Color(150,207,141));
            getContentPane().setBackground(new java.awt.Color(170,255,140));
            //setVisible(true);           
            //setUndecorated(true); 
                   
            innerPanel = new javax.swing.JPanel();
            innerPanel.setLayout(null);
            innerPanel.setBackground(new java.awt.Color(160,255,140));
            //innerPanel.setBackground(new java.awt.Color(0,0,0));
            //innerPanel.setBorder(new javax.swing.border.CompoundBorder());
            innerPanel.setBorder(new javax.swing.border.TitledBorder(new javax.swing.border.TitledBorder(null, "", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Times New Roman", 1, 12))));
            getContentPane().add(innerPanel);
            innerPanel.setBounds(20,70,975,580);
            
            MainMenuBar = new javax.swing.JMenuBar();
            setJMenuBar(MainMenuBar);
                    
            FileMenu = new javax.swing.JMenu();
            FileMenu.setBorder(new javax.swing.border.EtchedBorder());
            FileMenu.setText(" File");
            FileMenu.setFont(new java.awt.Font("Bookman Old Style",1,14));
            FileMenu.setPreferredSize(new java.awt.Dimension(49,20));
            MainMenuBar.add(FileMenu);
            
            NewScenarioMenuItem = new javax.swing.JMenuItem();
            NewScenarioMenuItem.setBorder(new javax.swing.border.EtchedBorder());
            NewScenarioMenuItem.setText("New Scenario");
            NewScenarioMenuItem.setFont(new java.awt.Font("Bookman Old Style",0,14));
            NewScenarioMenuItem.setPreferredSize(new java.awt.Dimension(120,20));
            FileMenu.add(NewScenarioMenuItem);
            
            OpenScenarioMenuItem = new javax.swing.JMenuItem();
            OpenScenarioMenuItem.setBorder(new javax.swing.border.EtchedBorder());
            OpenScenarioMenuItem.setText("Open Scenario");
            OpenScenarioMenuItem.setFont(new java.awt.Font("Bookman Old Style",0,14));
            OpenScenarioMenuItem.setPreferredSize(new java.awt.Dimension(120,20));
            FileMenu.add(OpenScenarioMenuItem);
            
            SaveScenarioMenuItem = new javax.swing.JMenuItem();
            SaveScenarioMenuItem.setBorder(new javax.swing.border.EtchedBorder());
            SaveScenarioMenuItem.setText("Save Scenario");
            SaveScenarioMenuItem.setFont(new java.awt.Font("Bookman Old Style",0,14));
            SaveScenarioMenuItem.setPreferredSize(new java.awt.Dimension(120,20));
            FileMenu.add(SaveScenarioMenuItem);
            
            ClearOutputWindowMenuItem = new javax.swing.JMenuItem();
            ClearOutputWindowMenuItem.setBorder(new javax.swing.border.EtchedBorder());
            ClearOutputWindowMenuItem.setText("Clear Output Window");
            ClearOutputWindowMenuItem.setFont(new java.awt.Font("Bookman Old Style",0,14));
            ClearOutputWindowMenuItem.setPreferredSize(new java.awt.Dimension(170,20));
            FileMenu.add(ClearOutputWindowMenuItem);
            
            ExitMenuItem = new javax.swing.JMenuItem();
            ExitMenuItem.setBorder(new javax.swing.border.EtchedBorder());
            ExitMenuItem.setText("Exit");
            ExitMenuItem.setFont(new java.awt.Font("Bookman Old Style",0,14));
            ExitMenuItem.setPreferredSize(new java.awt.Dimension(120,20));
            FileMenu.add(ExitMenuItem);
        
            ScenarioMenu = new javax.swing.JMenu();
            ScenarioMenu.setBorder(new javax.swing.border.EtchedBorder());
            ScenarioMenu.setText("Scenario");
            ScenarioMenu.setFont(new java.awt.Font("Bookman Old Style",1,14));
            ScenarioMenu.setPreferredSize(new java.awt.Dimension(73,20));
            MainMenuBar.add(ScenarioMenu);
            
            EditScenarioMenuItem = new javax.swing.JMenuItem();
            EditScenarioMenuItem.setBorder(new javax.swing.border.EtchedBorder());
            EditScenarioMenuItem.setText("Edit Scenario");
            EditScenarioMenuItem.setFont(new java.awt.Font("Bookman Old Style",0,14));
            EditScenarioMenuItem.setPreferredSize(new java.awt.Dimension(110,20));
            ScenarioMenu.add(EditScenarioMenuItem);
            
            CheckSyntaxScenarioMenuItem = new javax.swing.JMenuItem();
            CheckSyntaxScenarioMenuItem.setBorder(new javax.swing.border.EtchedBorder());
            CheckSyntaxScenarioMenuItem.setText("Check Scenario Syntax");
            CheckSyntaxScenarioMenuItem.setFont(new java.awt.Font("Bookman Old Style",0,14));
            CheckSyntaxScenarioMenuItem.setPreferredSize(new java.awt.Dimension(180,20));
            ScenarioMenu.add(CheckSyntaxScenarioMenuItem);
            
            OpenScenarioGeneratorMenuItem = new javax.swing.JMenuItem();
            OpenScenarioGeneratorMenuItem.setBorder(new javax.swing.border.EtchedBorder());
            OpenScenarioGeneratorMenuItem.setText("Open Scenario Generator");
            OpenScenarioGeneratorMenuItem.setFont(new java.awt.Font("Bookman Old Style",0,14));
            OpenScenarioGeneratorMenuItem.setPreferredSize(new java.awt.Dimension(200,20));
            ScenarioMenu.add(OpenScenarioGeneratorMenuItem);
        
            RunMenu = new javax.swing.JMenu();
            RunMenu.setBorder(new javax.swing.border.EtchedBorder());
            RunMenu.setText("  Run");
            RunMenu.setFont(new java.awt.Font("Bookman Old Style",1,14));
            RunMenu.setPreferredSize(new java.awt.Dimension(74,20));
            MainMenuBar.add(RunMenu);
            
            RunSimulationMenuItem = new javax.swing.JMenuItem();
            RunSimulationMenuItem.setBorder(new javax.swing.border.EtchedBorder());
            RunSimulationMenuItem.setText("Run Simulation");
            RunSimulationMenuItem.setFont(new java.awt.Font("Bookman Old Style",0,14));
            RunSimulationMenuItem.setPreferredSize(new java.awt.Dimension(130,20));
            RunMenu.add(RunSimulationMenuItem);
            
            MakeQueryMenuItem = new javax.swing.JMenuItem();
            MakeQueryMenuItem.setBorder(new javax.swing.border.EtchedBorder());
            MakeQueryMenuItem.setText("Make Query");
            MakeQueryMenuItem.setFont(new java.awt.Font("Bookman Old Style",0,14));
            MakeQueryMenuItem.setPreferredSize(new java.awt.Dimension(110,20));
            RunMenu.add(MakeQueryMenuItem);
            
            HelpMenu = new javax.swing.JMenu();
            HelpMenu.setBorder(new javax.swing.border.EtchedBorder());
            HelpMenu.setText("  Help");
            HelpMenu.setFont(new java.awt.Font("Bookman Old Style",1,14));
            HelpMenu.setPreferredSize(new java.awt.Dimension(77,20));
            MainMenuBar.add(HelpMenu);
            
            ReadMeMenuItem = new javax.swing.JMenuItem();
            ReadMeMenuItem.setBorder(new javax.swing.border.EtchedBorder());
            ReadMeMenuItem.setText("Read Me");
            ReadMeMenuItem.setFont(new java.awt.Font("Bookman Old Style",0,14));
            ReadMeMenuItem.setPreferredSize(new java.awt.Dimension(77,20));
            HelpMenu.add(ReadMeMenuItem);
            
            AboutMenuItem = new javax.swing.JMenuItem();
            AboutMenuItem.setBorder(new javax.swing.border.EtchedBorder());
            AboutMenuItem.setText("About");
            AboutMenuItem.setFont(new java.awt.Font("Bookman Old Style",0,14));
            AboutMenuItem.setPreferredSize(new java.awt.Dimension(77,20));
            HelpMenu.add(AboutMenuItem);
            
            TitleLabel = new javax.swing.JLabel();
            TitleLabel.setFont(new java.awt.Font("Arial",1,16));
            TitleLabel.setText("  Dynamic Environment Reasoning System");
            //TitleLabel.setHorizontalTextPosition(SwingConstants.CENTER);
            TitleLabel.setBackground(new java.awt.Color(200,255,100));
            TitleLabel.setBorder(new javax.swing.border.EtchedBorder());
            getContentPane().add(TitleLabel);
            TitleLabel.setBounds(600,20,340,30);
            
            
            AlgorithmLabel = new javax.swing.JLabel();
            AlgorithmLabel.setFont(new java.awt.Font("Bookman Old Style",0,13));
            AlgorithmLabel.setText("Selected Inference Algorithm:");
            innerPanel.add(AlgorithmLabel);
            AlgorithmLabel.setBounds(20,10,210,30);
            
            ScenarioLabel = new javax.swing.JLabel();
            ScenarioLabel.setFont(new java.awt.Font("Bookman Old Style",0,13));
            ScenarioLabel.setText("Selected Scenario:");
            innerPanel.add(ScenarioLabel);
            ScenarioLabel.setBounds(260,10,170,30);
            
            GoalLabel = new javax.swing.JLabel();
            GoalLabel.setFont(new java.awt.Font("Bookman Old Style",0,13));
            GoalLabel.setText("Selected Goal:");
            innerPanel.add(GoalLabel);
            GoalLabel.setBounds(460,10,170,30);
            
            TimeLabel = new javax.swing.JLabel();
            TimeLabel.setFont(new java.awt.Font("Bookman Old Style",0,13));
            TimeLabel.setText("Selected Time:");
            innerPanel.add(TimeLabel);
            TimeLabel.setBounds(630,10,170,30);
            
            PredicateLabel = new javax.swing.JLabel();
            PredicateLabel.setFont(new java.awt.Font("Bookman Old Style",0,13));
            PredicateLabel.setText("Predicate:");
            innerPanel.add(PredicateLabel);
            PredicateLabel.setBounds(810,10,170,30);
        
            AlgorithmTextField = new java.awt.TextField();
            innerPanel.add(AlgorithmTextField);
            AlgorithmTextField.setBounds(40,60,100,20);
            //AlgorithmTextField.setVisible(true);
            
            ScenarioTextField = new java.awt.TextField();
            innerPanel.add(ScenarioTextField);
            ScenarioTextField.setBounds(270,60,100,20);
            
            GoalTextField = new java.awt.TextField();
            innerPanel.add(GoalTextField);
            GoalTextField.setBounds(470,60,100,20);
            
            TimeTextField = new java.awt.TextField();
            innerPanel.add(TimeTextField);
            TimeTextField.setBounds(640,60,100,20);
            
            PredicateTextField = new java.awt.TextField();
            innerPanel.add(PredicateTextField);
            PredicateTextField.setBounds(820,60,100,20);
            
            SearchButton = new javax.swing.JButton();
            SearchButton.setFont(new java.awt.Font("Bookman Old Style",1,13));
            SearchButton.setText("Search");
            innerPanel.add(SearchButton);
            SearchButton.setBounds(280,100,90,20);
            
            HoldsButton = new javax.swing.JButton();
            HoldsButton.setFont(new java.awt.Font("Bookman Old Style",1,13));
            HoldsButton.setText("Holds");
            innerPanel.add(HoldsButton);
            HoldsButton.setBounds(830,100,80,20);
        
            OutputWindow = new java.awt.TextArea();
            Font equalSpacedFont = new Font("Monospaced",Font.PLAIN,14);
            OutputWindow.setFont(equalSpacedFont);
            OutputWindow.setEditable(false);
            innerPanel.add(OutputWindow);
            OutputWindow.setBounds(40,160,900,400);
            
        }//end initiateComponents()
        
        public static void main(String args[]) {
            //displays interface
           //new NewClass7().show();
           
           NewClass7.setDefaultLookAndFeelDecorated(true);
    		SwingUtilities.invokeLater(new Runnable() {
    			@Override
    			public void run() {
    				NewClass7 nc7 = new NewClass7();
    				nc7.setVisible(true);
    			}
    		}); 
        }//end main()
    
    }//end NewClass7

    Thank You,

    ~ Floetic ~

  2. #2
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Posts
    1,576
    Rep Power
    9

    Default

    Java Code:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.border.*;
    
    public class NC7 extends JFrame{
        
        public NC7() {
            //prolog.loadProlog("",0,1);
            initiateComponents();        
        }
        
        //declare interface properties
        //public final LpaIS prolog=new LpaIS();
        /*public String GlobalCheckSyntaxFile="";
         * public String GlobalEditFile="";
         * public String GlobalLoadFile="";
         * public final LpaIS CheckSynatxProlog=new LpaIS(); */
        
        private JPanel innerPanel;
        
        private JMenuBar MainMenuBar;
          
        private JMenu FileMenu;
        private JMenuItem NewScenarioMenuItem;
        private JMenuItem OpenScenarioMenuItem;
        private JMenuItem SaveScenarioMenuItem;
        private JMenuItem ClearOutputWindowMenuItem;
        private JMenuItem ExitMenuItem;
        
        private JMenu ScenarioMenu;
        private JMenuItem EditScenarioMenuItem;
        private JMenuItem CheckSyntaxScenarioMenuItem;
        private JMenuItem OpenScenarioGeneratorMenuItem;
        
        private JMenu RunMenu;
        private JMenuItem RunSimulationMenuItem;
        private JMenuItem MakeQueryMenuItem;
        
        private JMenu HelpMenu;
        private JMenuItem ReadMeMenuItem;
        private JMenuItem AboutMenuItem;
        
        private JLabel TitleLabel;
        
        private JLabel AlgorithmLabel;
        private JLabel ScenarioLabel;
        private JLabel GoalLabel;
        private JLabel TimeLabel;
        private JLabel PredicateLabel;
    /*
        private TextField AlgorithmTextField;
        private TextField ScenarioTextField;
        private TextField GoalTextField;
        private TextField TimeTextField;
        private TextField PredicateTextField;
    */
        // Try using Swing/lightweight components
        // instead of AWT/heavyweight components
        // for your text components.
        private JTextField AlgorithmTextField;
        private JTextField ScenarioTextField;
        private JTextField GoalTextField;
        private JTextField TimeTextField;
        private JTextField PredicateTextField;
        
        private JButton SearchButton;
        private JButton HoldsButton;
        
    //    private TextArea OutputWindow;
        private JTextArea OutputWindow;
        
        private void initiateComponents() {
            // Configure JFrame.
            getContentPane().setLayout(null);
            setTitle("Dynamic Environment Reasoning System");
            setSize(new Dimension(1025, 703));
            setLocation(200, 50);
            setResizable(false);
            setDefaultCloseOperation(EXIT_ON_CLOSE);
            //getContentPane().setBackground(new Color(150,207,141));
            getContentPane().setBackground(new Color(170,255,140));
            //setVisible(true);           
            //setUndecorated(true);
    
            // Add components.
            getContentPane().add(getInnerPanel());
            setJMenuBar(getMainMenuBar());
            getContentPane().add(getTitleLabel());
            populateInnerPanel();
        }
    
        private JMenuBar getMainMenuBar() {
            MainMenuBar = new JMenuBar();
                    
            FileMenu = new JMenu();
            FileMenu.setBorder(new EtchedBorder());
            FileMenu.setText(" File");
            FileMenu.setFont(new Font("Bookman Old Style",1,14));
            FileMenu.setPreferredSize(new Dimension(49,20));
            MainMenuBar.add(FileMenu);
            
            NewScenarioMenuItem = new JMenuItem();
            NewScenarioMenuItem.setBorder(new EtchedBorder());
            NewScenarioMenuItem.setText("New Scenario");
            NewScenarioMenuItem.setFont(new Font("Bookman Old Style",0,14));
            NewScenarioMenuItem.setPreferredSize(new Dimension(120,20));
            FileMenu.add(NewScenarioMenuItem);
            
            OpenScenarioMenuItem = new JMenuItem();
            OpenScenarioMenuItem.setBorder(new EtchedBorder());
            OpenScenarioMenuItem.setText("Open Scenario");
            OpenScenarioMenuItem.setFont(new Font("Bookman Old Style",0,14));
            OpenScenarioMenuItem.setPreferredSize(new Dimension(120,20));
            FileMenu.add(OpenScenarioMenuItem);
            
            SaveScenarioMenuItem = new JMenuItem();
            SaveScenarioMenuItem.setBorder(new EtchedBorder());
            SaveScenarioMenuItem.setText("Save Scenario");
            SaveScenarioMenuItem.setFont(new Font("Bookman Old Style",0,14));
            SaveScenarioMenuItem.setPreferredSize(new Dimension(120,20));
            FileMenu.add(SaveScenarioMenuItem);
            
            ClearOutputWindowMenuItem = new JMenuItem();
            ClearOutputWindowMenuItem.setBorder(new EtchedBorder());
            ClearOutputWindowMenuItem.setText("Clear Output Window");
            ClearOutputWindowMenuItem.setFont(
                new Font("Bookman Old Style",0,14));
            ClearOutputWindowMenuItem.setPreferredSize(new Dimension(170,20));
            FileMenu.add(ClearOutputWindowMenuItem);
            
            ExitMenuItem = new javax.swing.JMenuItem();
            ExitMenuItem.setBorder(new EtchedBorder());
            ExitMenuItem.setText("Exit");
            ExitMenuItem.setFont(new Font("Bookman Old Style",0,14));
            ExitMenuItem.setPreferredSize(new Dimension(120,20));
            FileMenu.add(ExitMenuItem);
        
            ScenarioMenu = new javax.swing.JMenu();
            ScenarioMenu.setBorder(new EtchedBorder());
            ScenarioMenu.setText("Scenario");
            ScenarioMenu.setFont(new Font("Bookman Old Style",1,14));
            ScenarioMenu.setPreferredSize(new Dimension(73,20));
            MainMenuBar.add(ScenarioMenu);
            
            EditScenarioMenuItem = new JMenuItem();
            EditScenarioMenuItem.setBorder(new EtchedBorder());
            EditScenarioMenuItem.setText("Edit Scenario");
            EditScenarioMenuItem.setFont(new Font("Bookman Old Style",0,14));
            EditScenarioMenuItem.setPreferredSize(new Dimension(110,20));
            ScenarioMenu.add(EditScenarioMenuItem);
            
            CheckSyntaxScenarioMenuItem = new JMenuItem();
            CheckSyntaxScenarioMenuItem.setBorder(new EtchedBorder());
            CheckSyntaxScenarioMenuItem.setText("Check Scenario Syntax");
            CheckSyntaxScenarioMenuItem.setFont(
                new Font("Bookman Old Style",0,14));
            CheckSyntaxScenarioMenuItem.setPreferredSize(new Dimension(180,20));
            ScenarioMenu.add(CheckSyntaxScenarioMenuItem);
            
            OpenScenarioGeneratorMenuItem = new JMenuItem();
            OpenScenarioGeneratorMenuItem.setBorder(new EtchedBorder());
            OpenScenarioGeneratorMenuItem.setText("Open Scenario Generator");
            OpenScenarioGeneratorMenuItem.setFont(
                new Font("Bookman Old Style",0,14));
            OpenScenarioGeneratorMenuItem.setPreferredSize(new Dimension(200,20));
            ScenarioMenu.add(OpenScenarioGeneratorMenuItem);
        
            RunMenu = new javax.swing.JMenu();
            RunMenu.setBorder(new EtchedBorder());
            RunMenu.setText("  Run");
            RunMenu.setFont(new Font("Bookman Old Style",1,14));
            RunMenu.setPreferredSize(new Dimension(74,20));
            MainMenuBar.add(RunMenu);
            
            RunSimulationMenuItem = new JMenuItem();
            RunSimulationMenuItem.setBorder(new EtchedBorder());
            RunSimulationMenuItem.setText("Run Simulation");
            RunSimulationMenuItem.setFont(
                new Font("Bookman Old Style",0,14));
            RunSimulationMenuItem.setPreferredSize(new Dimension(130,20));
            RunMenu.add(RunSimulationMenuItem);
            
            MakeQueryMenuItem = new JMenuItem();
            MakeQueryMenuItem.setBorder(new EtchedBorder());
            MakeQueryMenuItem.setText("Make Query");
            MakeQueryMenuItem.setFont(new Font("Bookman Old Style",0,14));
            MakeQueryMenuItem.setPreferredSize(new Dimension(110,20));
            RunMenu.add(MakeQueryMenuItem);
            
            HelpMenu = new javax.swing.JMenu();
            HelpMenu.setBorder(new EtchedBorder());
            HelpMenu.setText("  Help");
            HelpMenu.setFont(new Font("Bookman Old Style",1,14));
            HelpMenu.setPreferredSize(new Dimension(77,20));
            MainMenuBar.add(HelpMenu);
            
            ReadMeMenuItem = new JMenuItem();
            ReadMeMenuItem.setBorder(new EtchedBorder());
            ReadMeMenuItem.setText("Read Me");
            ReadMeMenuItem.setFont(new Font("Bookman Old Style",0,14));
            ReadMeMenuItem.setPreferredSize(new Dimension(77,20));
            HelpMenu.add(ReadMeMenuItem);
            
            AboutMenuItem = new JMenuItem();
            AboutMenuItem.setBorder(new EtchedBorder());
            AboutMenuItem.setText("About");
            AboutMenuItem.setFont(new Font("Bookman Old Style",0,14));
            AboutMenuItem.setPreferredSize(new Dimension(77,20));
            HelpMenu.add(AboutMenuItem);
            return MainMenuBar;
        }
    
        private JLabel getTitleLabel() {
            TitleLabel = new JLabel();
            TitleLabel.setFont(new Font("Arial",1,16));
            TitleLabel.setText("  Dynamic Environment Reasoning System");
            //TitleLabel.setHorizontalTextPosition(SwingConstants.CENTER);
            TitleLabel.setBackground(new Color(200,255,100));
            TitleLabel.setBorder(new EtchedBorder());
            TitleLabel.setBounds(600,20,340,30);
            return TitleLabel;
        }
    
        private JPanel getInnerPanel() {
            innerPanel = new JPanel();
            innerPanel.setLayout(null);
            innerPanel.setBackground(new Color(160,255,140));
            //innerPanel.setBackground(new Color(0,0,0));
            //innerPanel.setBorder(new CompoundBorder());
            innerPanel.setBorder(new TitledBorder(
                    new TitledBorder(null, "",
                        TitledBorder.DEFAULT_JUSTIFICATION,
                        TitledBorder.DEFAULT_POSITION,
                        new Font("Times New Roman", 1, 12))));
            innerPanel.setBounds(20,70,975,580);
            return innerPanel;
        }
    
        private void populateInnerPanel() {
            AlgorithmLabel = new JLabel();
            AlgorithmLabel.setFont(new Font("Bookman Old Style",0,13));
            AlgorithmLabel.setText("Selected Inference Algorithm:");
            innerPanel.add(AlgorithmLabel);
            AlgorithmLabel.setBounds(20,10,210,30);
            
            ScenarioLabel = new JLabel();
            ScenarioLabel.setFont(new Font("Bookman Old Style",0,13));
            ScenarioLabel.setText("Selected Scenario:");
            innerPanel.add(ScenarioLabel);
            ScenarioLabel.setBounds(260,10,170,30);
            
            GoalLabel = new JLabel();
            GoalLabel.setFont(new Font("Bookman Old Style",0,13));
            GoalLabel.setText("Selected Goal:");
            innerPanel.add(GoalLabel);
            GoalLabel.setBounds(460,10,170,30);
            
            TimeLabel = new JLabel();
            TimeLabel.setFont(new Font("Bookman Old Style",0,13));
            TimeLabel.setText("Selected Time:");
            innerPanel.add(TimeLabel);
            TimeLabel.setBounds(630,10,170,30);
            
            PredicateLabel = new JLabel();
            PredicateLabel.setFont(new Font("Bookman Old Style",0,13));
            PredicateLabel.setText("Predicate:");
            innerPanel.add(PredicateLabel);
            PredicateLabel.setBounds(810,10,170,30);
        
            AlgorithmTextField = new JTextField();
            innerPanel.add(AlgorithmTextField);
            AlgorithmTextField.setBounds(40,60,100,20);
            //AlgorithmTextField.setVisible(true);
            
            ScenarioTextField = new JTextField();
            innerPanel.add(ScenarioTextField);
            ScenarioTextField.setBounds(270,60,100,20);
            
            GoalTextField = new JTextField();
            innerPanel.add(GoalTextField);
            GoalTextField.setBounds(470,60,100,20);
            
            TimeTextField = new JTextField();
            innerPanel.add(TimeTextField);
            TimeTextField.setBounds(640,60,100,20);
            
            PredicateTextField = new JTextField();
            innerPanel.add(PredicateTextField);
            PredicateTextField.setBounds(820,60,100,20);
            
            SearchButton = new JButton();
            SearchButton.setFont(new Font("Bookman Old Style",1,13));
            SearchButton.setText("Search");
            innerPanel.add(SearchButton);
            SearchButton.setBounds(280,100,90,20);
            
            HoldsButton = new JButton();
            HoldsButton.setFont(new Font("Bookman Old Style",1,13));
            HoldsButton.setText("Holds");
            innerPanel.add(HoldsButton);
            HoldsButton.setBounds(830,100,80,20);
        
            OutputWindow = new JTextArea();
            Font equalSpacedFont = new Font("Monospaced",Font.PLAIN,14);
            OutputWindow.setFont(equalSpacedFont);
            OutputWindow.setEditable(false);
            JScrollPane scrollPane = new JScrollPane(OutputWindow);
            scrollPane.setBounds(40,160,900,400);
            innerPanel.add(scrollPane);
    //        innerPanel.add(OutputWindow);
    //        OutputWindow.setBounds(40,160,900,400);
    
        }
        
        public static void main(String args[]) {
            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    JFrame.setDefaultLookAndFeelDecorated(true);
                    NC7 nc7 = new NC7();
                    nc7.setVisible(true);
                }
            }); 
        }
    }

  3. #3
    Floetic's Avatar
    Floetic is offline Member
    Join Date
    Feb 2008
    Location
    Belfast, Northern Ireland, UK
    Posts
    8
    Rep Power
    0

Similar Threads

  1. Implementing Interface
    By mew in forum New To Java
    Replies: 4
    Last Post: 02-16-2010, 03:33 PM
  2. Need help with Document interface
    By cbalu in forum AWT / Swing
    Replies: 1
    Last Post: 11-30-2007, 11:03 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •