Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / March 2008

Tip: Looking for answers? Try searching our database.

DERS Interface

Thread view: 
Soul Tech - 09 Mar 2008 09:08 GMT
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:

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 ~
Michael Dunn - 09 Mar 2008 10:18 GMT
> Hey There,
>
[quoted text clipped - 5 lines]
> 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?

do you realize that by posting this crap at (what is it now, 7) different forums/newsgroups
all you are doing is wasting the time of all those that try to help you.

ah, silly me, your time is much more important than anyone else's.
I beg your forgiveness.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.