Newbie: Java FX Resizable Gui Layout

Dear all,
I am trying to create a User Interface for entering address data. The GUI should be resizable so i was experimenting with the jfxtras Grid Layout.
With the included code a rudimentary Gui is created. My Problem is that i cannot control the initial sizes of my TextBoxes. In my example the Kunden Nr is too large. The Name and Vorname Fields are too small. I tried to manage the sizes using the hspan variable. Defining widths using layoutInfo was not successful.
Can anyone give me a hint how to set sizes for TextBoxes ?
Thanks in advance
import org.jfxtras.scene.layout.*;
import org.jfxtras.scene.*;
import javafx.scene.*;
import javafx.stage.*;
import ch.bizWare.fx.components.*;
import javafx.scene.control.TextBox;
import javafx.scene.text.*;
import javafx.scene.layout.*;
import org.jfxtras.scene.shape.*;
import javafx.scene.paint.*;
// Container Definition
var scene : ResizableScene;
var mainStage : Stage;
var tbKdNr : TextBox = TextBox{
    layoutInfo: GridLayoutInfo{hgrow: Grow.ALWAYS}
var lKdNr : Text = Text{
    content: "Kunden Nr"
var tbAnrede : TextBox = TextBox{
    layoutInfo: GridLayoutInfo{hgrow: Grow.ALWAYS, hspan: 1}
var lAnrede : Text = Text{
    content: "Anrede"
var tbName : TextBox = TextBox{
    layoutInfo: GridLayoutInfo{hgrow: Grow.ALWAYS, hspan : 2}
var lName : Text = Text{
    content: "Name"
var tbVorname : TextBox = TextBox{
    layoutInfo: GridLayoutInfo{hgrow: Grow.ALWAYS, hspan: 2}
var lVorname : Text = Text{
    content: "Vorname"
var tbAdresse : TextBox = TextBox{
    layoutInfo: GridLayoutInfo{hgrow: Grow.ALWAYS, hspan: 4}
var lAdresse : Text = Text{
    content: "Adresse des Kunden"
var tbPlzOrt : TextBox = TextBox{
    layoutInfo: GridLayoutInfo{hgrow: Grow.ALWAYS, hspan: 2}
var lPlzOrt : Text = Text{
    content: "PLZ/Ort"
var grid : Grid = Grid {
    rows: [ Row{
                 cells : [lKdNr, tbKdNr]
            Row{
                cells : [lAnrede, tbAnrede, lName, tbName, lVorname, tbVorname]
            Row{
                cells : [lAdresse, tbAdresse, lPlzOrt, tbPlzOrt]
scene = ResizableScene {
   width : 600;
   height: 200;
   content:grid    
// Stage Initialize
mainStage = Stage {
    title : "Adresse erfassen"
    scene : scene
}

Here is my resizable custom EmployeeUI component with address
package ui.custom;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;
import javafx.scene.paint.Color;
import org.jfxtras.scene.ResizableScene;
import javafx.scene.text.Text;
import org.jfxtras.scene.layout.MigLayout;
import org.jfxtras.scene.layout.MigLayout.*;
import loans.calc.*;
import javafx.stage.Stage;
import javafx.scene.Node;
import javafx.scene.paint.Color;
import javafx.scene.control.TextBox;
import javafx.scene.control.Button;
import javafx.scene.CustomNode;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.Stack;
import org.jfxtras.scene.ResizableCustomNode;
import org.jfxtras.scene.layout.ResizableVBox;
import org.jfxtras.stage.JFXDialog;
import javafx.ext.swing.SwingComboBox;
import javafx.ext.swing.SwingComboBoxItem;
import javafx.util.Sequences;
import javafx.scene.paint.LinearGradient;
import javafx.scene.paint.Stop;
import javafx.scene.text.Font;
import javafx.ext.swing.SwingComponent;
import javax.swing.JTextArea;
import javax.swing.JScrollPane;
import javafx.ext.swing.SwingTextField;
import javafx.scene.shape.Line;
* @author gusaros
public class EmployeeUI extends ResizableCustomNode {
var linearGradient = LinearGradient {
            endY: 1 endX: 0
            stops : [
                Stop { offset: 0.0 color: Color.web("#eae8e3") },
                Stop { offset: 1.0 color: Color.WHITE },
public  var employee:Employee;
var line1 = Line {
          startX: 10, startY: 10
          endY: 10
          endX: bind width - 10
          // endX: 230, endY: 100
          strokeWidth: 2
          stroke: Color.DARKGRAY
var header = Text {content:
           "E m p l o y e e   i n f o r m a t i o n"
           font: Font.font("Serif",18)
     var emptyLabel=Label {
         id:"emptyLabel"
         text: ""};
  var firstNameLabel=Label {
         id:"firstNameLabel"
         text: "First Name:"};
var firstNameField=TextBox {
       id:"firstNameField"
       selectOnFocus: false
       editable:false
       text: bind employee.firstName
   var lastNameLabel=Label {
       id:"lastNameLabel"
        text: "Last Name:" };
    var lastNameField=TextBox {
    id:"lastNameField"
    text: bind employee.lastName
var dobLabel=Label {
       id:"dobLabel"
        text: "DOB:" };
var dobField=TextBox {
    id:"dobField" };
var taxNumberLabel=Label {
       id:"taxNumberLabel"
        text: "Tax number:" };
var taxNumberField=TextBox {
    id:"taxNumberField" };
var titleLabel=Label {
       id:"titleLabel"
        text: "Title:" };
var titleField=TextBox {
    id:"titleField" };
var planTypeLabel=Label {
       id:"planTypeLabel"
        text: "Plan type:" };
var planTypeField=TextBox {
    id:"planTypeField" };
var activeStatusLabel=Label {
       id:"activeStatusLabel"
        text: "Active status:" };
var activeStatusField=TextBox {
    id:"activeStatusField"
  var serviceLabel=Label {
       id:"servicel"
        text: "Service:" };
var serviceField=TextBox {
    id:"servicef"  };
var deductionsLabel=Label {
       id:"deductionsLabel"
        text: "Deductions:" };
var deductionsField=TextBox {
    id:"deductionsField"
    text:"0"
var deductionsLabel75=Label {
       id:"deductionsLabel75"
        text: bind if (activeStatusField.text == "B")   " 75% deductions:"  else
        " 90% deductions:"         };
var deductionsField75=TextBox {
    id:"deductionsField75"
    text: bind if (activeStatusField.text == "B") "{Double.parseDouble(deductionsField.text) * 0.75 }"
              else  "{Double.parseDouble(deductionsField.text) * 0.9 }"
var minPaymentLabel=Label {
       id:"minpaymentLabel"
        text: "Minimum payment:" };
var minPaymentField=TextBox {
       id:"minpaymentfield"
var reserveLabel=Label {
       id:"reserveLabel"
        text: "Reserve:" };
var reserveField=TextBox {
    id:"reserveField"
    text:""
var taxableamtLabel=Label {
       id:"taxableamtLabel"
        text: "Taxable amt:" };
var taxableamtField=TextBox {
    id:"taxableamtField"
    text:""
var dcploanLabel=Label {
       id:"ldcploanLabel"
        text: "Current DCP loan :" };
var dcploanField=TextBox {
    id:"dcploanField"
    text:""
var addressLabel=Label {
    id:"addressLabel"
    text: "Address:"
var addressField=TextBox {
    id:"addressField"
var cityLabel=Label {
    id:"cityLabel"
    text: "City:"
var cityField=TextBox {
    id:"cityField"
var stateLabel=Label {
    id:"stateLabel"
    text: "State:"
var stateField = TextBox {
    id: "statefield"
    columns: 2
var stateField:SwingComboBox = SwingComboBox {
   id: "stateField"
   items: [
      SwingComboBoxItem{text:"MD"},
      SwingComboBoxItem{text:"CA"},
      SwingComboBoxItem{text:"NY"}
   visible: true
var zipLabel=Label {
   id:"zipCodeLabel"
   text: "ZIP Code:"
var zipField=TextBox {
   id:"zipCodeField"
  // Nodes to be laid out
var nodesToLayout = bind [
    migNode(header, "span,alignx center, wrap" ),
      migNode(emptyLabel,   "wrap" ),
   migNode(firstNameLabel,  "" ),
   migNode(firstNameField,  "" ),
   migNode(lastNameLabel,  "alignx right" ),
   migNode(lastNameField, "" ),
   migNode(dobLabel, "alignx right" ),
   migNode(dobField, "wrap" ),
   migNode(taxNumberLabel, "" ),
   migNode(taxNumberField, "" ),
    migNode(titleLabel, "alignx right" ),
   migNode(titleField, "span, grow,wrap" ),
   migNode(planTypeLabel, "" ),
   migNode(planTypeField, "" ),
   migNode(activeStatusLabel, "alignx right" ),
   migNode(activeStatusField, "" ),
   migNode(serviceLabel, "alignx right" ),
   migNode(serviceField, "wrap" ),
migNode(Label{ text:"" }, "wrap" ),
// migNode( line1, "span"  ),
// migNode(Label{ text:"" }, "wrap" ),
migNode(addressLabel, "" ),
  migNode(addressField,  "span, grow" ),
   migNode(cityLabel, "" ),
   migNode(cityField, "" ),
   migNode(stateLabel, "alignx right" ),
   migNode(stateField, "", ),
   migNode(zipLabel, "alignx right" ),
   migNode(zipField, "wrap" ),
   migNode(Label{ text:"" }, "wrap" ),
   // ... other nodes are added here ...
  var rowConstraintString:String = "";
var layoutConstraintString:String = "";
override function create() {
            MigLayout {
               constraints: bind layoutConstraintString
               content:bind  nodesToLayout
               rows: bind rowConstraintString
}

Similar Messages

  • GUI layout issues

    hi,
    i have some problems with my GUI design.
    i want it to have a toolbar at the top and a split pane below it. At the moment i have a horizontal split, however, i think that the text which is being written to my pane on the right hand side is not appearing altho the scrollbar indicates that text has been written to it.
    also when i click a button on my toolbar some of the toolbar becomes invisible for some reason.
    www.nashie.net/program.gif
    should give you an example of what i am trying to achieve with my layout.
    the current relevent code is as follows (excluding textfield declarations etc):
    ImageIcon downloadImage= new ImageIcon("send.gif");
    JButton downloadButton = new JButton(downloadImage);
    ImageIcon createImage = new ImageIcon("create.gif");
    JButton createButton = new JButton(createImage);
    JToolBar ToolBar = new JToolBar();
    ToolBar.add(createButton);
    ToolBar.add(downloadButton);
    splitpane.setOneTouchExpandable(true);
    splitpane.setDividerLocation(150);
    Dimension minimumSize = new Dimension(100, 50);
    jsp.setMinimumSize(minimumSize);
    arjsp.setMinimumSize(minimumSize);
    JPanel pane = new JPanel();
    pane.setLayout(new BorderLayout());
    pane.add(ToolBar, BorderLayout.NORTH);
    pane.add(splitpane, BorderLayout.SOUTH);
    setContentPane(pane);
    downloadButton.addActionListener(new DownloadAction());
    show();
    pack();
    setSize(400,400);
    any ideas how to fix this?

    import java.lang.*;
    import java.util.*;
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.plaf.basic.*;
    import java.awt.event.*;
    import java.net.*;
    import java.io.*;
    //GUI design below
    public class POP3a extends JFrame {
    // public JButton downloadButton = new JButton(
    //"Download Message");
    public JLabel hostLabel = new JLabel("Host: ");
    public JTextField hostField = new JTextField(40);
    public JLabel userLabel = new JLabel("Username: ");
    public JTextField userField = new JTextField(40);
    public JLabel passwordLabel = new JLabel("Password: ");
    public JPasswordField passwordField = new JPasswordField(20);
    public JTextArea message = new JTextArea();
    public JScrollPane jsp = new JScrollPane(message);
    public JTextArea archive = new JTextArea(80, 140);
    public JScrollPane arjsp = new JScrollPane(archive);
    public JSplitPane splitpane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, arjsp, jsp);
    public POP3a() { //This is the constructor
    super("Nashies - POP3 Program"); //title bar text
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    ImageIcon downloadImage= new ImageIcon("send.gif");
    JButton downloadButton = new JButton(downloadImage);
    ImageIcon createImage = new ImageIcon("create.gif");
    JButton createButton = new JButton(createImage);
    JToolBar ToolBar = new JToolBar();
    ToolBar.add(createButton);
    ToolBar.add(downloadButton);
    splitpane.setOneTouchExpandable(true);
    splitpane.setDividerLocation(150);
    Dimension minimumSize = new Dimension(100, 50);
    jsp.setMinimumSize(minimumSize);
    arjsp.setMinimumSize(minimumSize);
    JPanel pane = new JPanel();
    pane.setLayout(new BorderLayout());
    pane.add(ToolBar, BorderLayout.NORTH);
    pane.add(splitpane, BorderLayout.SOUTH);
    setContentPane(pane);
    downloadButton.addActionListener(new DownloadAction());
    show();
    pack();
    setSize(400,400);
    } //end of constructor
    public static void main(String args[]) {
    try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch(Exception e) {}
    POP3a P = new POP3a();
    } //end main
    private class DownloadAction implements ActionListener {
    Socket pop3_socket=null;
    DataInputStream input=null;
    PrintWriter output=null;
    String response_string = null;
    String host= new String(hostField.getText());
    String user= new String(userField.getText());
    String password = new String(passwordField.getText());
    int count = 0;
    String boundary;
    public void actionPerformed (ActionEvent evt) {
    try{ //open socket and request emails
    // an expansion of POP3Example.java but with LIST and RETR commands
    pop3_socket= new Socket(host,110);//open socket to server
    output=new PrintWriter(pop3_socket.getOutputStream(),true);
    input=new DataInputStream(pop3_socket.getInputStream());
    response_string=input.readLine();//get response from server
    message.setText(response_string);
    output.println("USER " + user);
    message.append("\nUSER " +user);
    response_string=input.readLine();
    message.append("\n" +response_string);
    output.println("PASS " +password);
    message.append("\nPASS **********" );
    response_string=input.readLine();
    message.append("\n" +response_string);
    output.println("LIST");
    message.append("\nLIST " );
    response_string=input.readLine();
    message.append(response_string);
    count=0; //set count to 0
    boundary = null;
    // while no terminator repeat commands
    while (!response_string.equals(".")) {
    response_string=input.readLine();
    message.append("\n"+response_string);
    count++; //increment count by 1 each time
    emaildownloader(); //this is the call to emaildownloader!!
    output.println("QUIT");//log off server procedure
    message.append("\nQUIT");
    response_string=input.readLine();
    message.append("\nresponse from pop3 server "
    + response_string );
    pop3_socket.close();//close the POP3 socket
    }// end try statement
    catch (UnknownHostException e) {
    message.append("response from pop3 server: "
    + "UnknownHostException " + response_string);//error message
    catch (IOException e) {
    message.append("response from pop3 server: "
    + "IOException "+response_string);//error message
    }//end action performed
    public void emaildownloader() throws IOException {
    int i; //declare i
    //set i to 1 to prevent RETR+0 which would return an error
    for (i=1; i<count; i++) {
    output.println("RETR "+i);
    message.append("\nRETR "+i);
    response_string=input.readLine();
    message.append("\n"+response_string);
    //while no terminator print email
    while (!response_string.equals(".")) {
    response_string=input.readLine();//read the line
    int endIndex;
         if (response_string.equals("Content-Type: multipart/mixed;")) {
    message.append("\n" +response_string);
         response_string=input.readLine();
    boundary=response_string;
    endIndex=boundary.length();
    endIndex=endIndex-1;
    boundary=boundary.substring(11, endIndex);
    boundary=("---" +boundary);
    boundary=(boundary +"--");
    }//end if
    //if that readline above equals the line specified
    //begin attachment handling
    if (response_string.equals("Content-Disposition: attachment;"))
    { //I would try to be more consistant with curly braces than
    //I am here, but I am using a small window to work with
    //and I couldn't keep it all on one line
    response_string=input.readLine();
    if (response_string.indexOf("=")>0) {
    int endchar;
    String filename;//declare filename
    FileOutputStream fos=null;
    ObjectOutputStream oos=null;
    String file;//declare string
    //file is equal to the substring
    file = response_string.substring(10);
    endchar=file.length();
    endchar=endchar-1;
    filename = file.substring(1, endchar);
    message.append("\nFile name: " + filename);
    response_string=input.readLine();
    message.append("\n" +response_string);
    try{
    fos = new FileOutputStream (filename);
    oos = new ObjectOutputStream (fos);
    } catch(IOException e) {
    message.append("\nProblem opening file: " +filename);
    message.append("\n\tSuccessfully created the file: "
    + filename);
    int linecount=0;
    //the attachment handling section below
    //while(!(response_string.equals(boundary)))
    //{ //open while
    // try{
    // oos.writeObject (response_string);
    // response_string=input.readLine();
    // linecount++;
    // catch(IOException e)
    // message.append("\nProblem writing to file: "
    // +filename);
    // message.append("at line " +linecount);
    //}//close while
    response_string=input.readLine();
    message.append("\n boundary is currently set to: "
    +boundary);
    }//close if
    else { // open else
    //again split 'cause my window is too small
    message.append("there is an error with the attachment "
    + "handling");
    } // close else
    response_string=input.readLine();
    } //close if
    message.append("\n"+response_string);
    } //close while ! '.'
    } //end for loop
    } // close emaildownloader()
    } //end DownloadAction
    } //end POP3 class
    The GUI is highly unstable and the text which should go in the JTextArea called 'message' doesn't get displayed (please note as I am switching my old layout etc over to a new one there is no way of entering hostname, username, password so the response from POP server should be 'response from pop3 server: IOException null' and that should get displayed in 'message' any ideas why the GUI is so screwed up?

  • Urgent HELP! how to resize a layout and change the color from black to white

    Hey!!!
    im in urgent help of someone to answer my questions. I have a huge Indesign exam monday and two of the questions are   
    -resizing a layout
    -changing a color layout to black and white
    I have done many porjects in Indesign but to be honest i don't know what they are refering but resizing a layout or changing the layout color to black and white. If any body can explain me this a little be I be so thankful!
    Thanks,
    Fiama Piccardo

    I've decided to relent a little and give you a hint, so you can do some looking and figure this out for yourself. Everything you need for either of those tasks is accessed from the File menu...
    And a further hint. Indesign does not have a black and white or grayscale working colorspace, so you never truly have a black and white layout, though all of the objects in the file may use only black ink. You can, however, output a PDF, in a couple of ways, that will convert your color file to one that uses only black.

  • Compressing a large PDF document using command line or Java code without GUI operations

    hi,
    I have a programatically generated very large PDF file with lots of tables and cells in it. The size of the file is few MBs. Using Adobe pro, I am able to reduce the size of the PDF in KBs. I want to achive it either through a command line or using Java API without GUI interaction.
    I am using JDK1.6.
    Thanks.

    I think you need the scripting or SDK forums http://forums.adobe.com/community/acrobat
    As far as I know, Acrobat does not have command line operation

  • Information java 1.6 gui

    i would like to know if somebody know if java gui will be more simple with java 1.6
    i very easy to create a gui with delphi, vb, qt designer....
    it's more complex with java?
    does gui speed will be better?
    thanks

    calm your nerves, morron
    don't answer the thread if you want to troll

  • How to make a table in java without using GUI??

    how can i make a table in java without usinf GUI, just simple codes??
    NAME ID NUMBER ADDRESS STATUS

    If you simply want to store them internally, you don't want to use a table.
    Make a simple class with properties id, name, number, address, status. Then create a Hashtable that indexes instances of the class by id or some other property.

  • Java button or gui to sit on desktop to launch

    I am looking for a way to put a Java button or gui to sit on desktop and run/launch a program

    Your question is a little bit to open.
    If you want an icon then I sugest you pack your application into a jar file, create a short cut an running it from there.
    However iit is a complete different story is what you want is a button that sits on your desktop and when it is clicked it opens a new window (which I think it is your application).
    In that case you would have to create another application itself. Create a Jframe (remove the border) and then add a JButton to it. When user clicks on the button (use button action) open the new window (by createing a new instance)
    Hope I understood you well!

  • I'm writing a mazerace game...I need help from a Java Pro regarding GUI

    I've tested my code using a textUI, but not successful with GUI.
    Following are the files I have at present but are incomplete...someone please assist me, let me know what I'm missing to run the program successfully in a window.
    All I need to do is to bring the maze (2D array) onto a window, and listen to the keys (A,S,D,W & J,K,L,I) and make the move accordingly (using the move method in the MazeRace Class)
    This is my class - MazeRace
    import javax.swing.*;
    import java.io.*;
    * This class is responsible for:
    * -Initializes instance variables used to store the current state of the game
    * -When a player moves it checks if the move is legal
    * and updates the state of the game if move is allowable and made
    * -Reports information about current state of the game when asked:
    * o whether game has been won
    * o how many moves have been made by a given player
    * o what is the current configuration of the maze, etc.
    public class MazeRace {
    /** The Maze Race layout */
    private static char[][] mazeLayout;
    /** Dimensions of the maze */
    //private static final int rowLength = mazeLayout.length;
    //private static final int columnLength = mazeLayout[0].length;
    /** space in the grid is a wall */
    private static final char wall = 'X';
    /** space in the grid has been used */
    private static final char spaceUsed = '.';
    /** space in the grid is available */
    private static final char spaceAvailable = ' ';
    /** Character for Charles, Ada & Goal*/
    private static final char CHARLES = 'C';
    private static final char ADA = 'A';
    private static final char GOAL = 'G';
    /** Location of Goal in the Maze */
    private static int rowGoal = 0;
    private static int columnGoal = 0;
    /** Location of Ada in the Maze */
    private static int rowAda = 0;
    private static int columnAda = 0;
    /** Location of Charles in the Maze */
    private static int rowCharles = 0;
    private static int columnCharles = 0;
    /** Number of Ada's moves */
    private static int countAdasMoves = 0;
    /** Number of Charles's moves */
    private static int countCharlesMoves = 0;
    * Constructor for MazeRace
    * &param mazeGrid - 2D array of characters
    public MazeRace(char[][] mazeGrid){
    this.mazeLayout = mazeGrid;
    for (int row = 0; row < mazeLayout.length; row++){
    for (int column = 0; column < mazeLayout[0].length; column++){
    if (mazeLayout[row][column] == GOAL){
    this.rowGoal = row;
    this.columnGoal = column;
    if (mazeLayout[row][column] == ADA){
    this.rowAda = row;
    this.columnAda = column;
    if (mazeLayout[row][column] == CHARLES){
    this.rowCharles = row;
    this.columnCharles = column;
    public boolean canMoveLeft(){
    int rowA = this.rowAda;
    int columnA = this.columnAda;
    int rowC = this.rowCharles;
    int columnC = this.rowCharles;
    boolean canMove = false;
    if (mazeLayout[rowA][columnA - 1] == spaceAvailable
    || mazeLayout[rowA][columnA - 1] == GOAL) {
    canMove = true;
    return canMove;
    * This method takes in a single character value that indicates
    * both the player making the move, and which direction the move is in.
    * If move is legal, the player's position will be updated. Move is legal
    * if player can move one space in that direction i.e. the player isn't
    * moving out of the maze, into a wall or a space has already been used.
    * @param moveDirection: indicates the player making the move and direction
    * @return moveMade: boolean value true if move was made, false otherwise
    public boolean move(char move){
    boolean validMove = false;
    /** store Ada's current row location in a temp variable */
    int rowA = this.rowAda;
    /** store Ada's current column location in a temp variable */
    int columnA = this.columnAda;
    /** store Charles current row location in a temp variable */
    int rowC = this.rowCharles;
    /** store Charles current column location in a temp variable */
    int columnC = this.columnCharles;
    /** if Ada is moving left, check if she can make a move */
    if (move == 'A' && (mazeLayout[rowA][columnA - 1] == spaceAvailable
    || mazeLayout[rowA][columnA - 1] == GOAL)) {
    /** if move is legal, then update old space to spaceUsed '.' */
    mazeLayout[rowA][columnA] = spaceUsed;
    /** update Ada's new position */
    mazeLayout[rowA][columnA - 1] = ADA;
    this.rowAda = rowA; //update new row location of Ada
    this.columnAda = columnA - 1; //update new column location of Ada
    validMove = true; //valid move has been made
    countAdasMoves++; //increment Ada's legal move
    /** if Ada is moving down, then check if she can make the move */
    if (move == 'S'&& (mazeLayout[rowA + 1][columnA] == spaceAvailable
    || mazeLayout[rowA + 1][columnA] == GOAL)) {
    mazeLayout[rowA][columnA] = spaceUsed;
    mazeLayout[rowA + 1][columnA] = ADA;
    this.rowAda = rowA + 1;
    this.columnAda = columnA;
    validMove = true;
    countAdasMoves++;
    /** if Ada is moving right, then check if she can make the move */
    if (move == 'D'&& (mazeLayout[rowA][columnA + 1] == spaceAvailable
    || mazeLayout[rowA][columnA + 1] == GOAL)) {
    mazeLayout[rowA][columnA] = spaceUsed;
    mazeLayout[rowA][columnA + 1] = ADA;
    this.rowAda = rowA;
    this.columnAda = columnA + 1;
    validMove = true;
    countAdasMoves++;
    /** if Ada is moving up, then check if she can make the move */
    if (move == 'W'&& (mazeLayout[rowA - 1][columnA] == spaceAvailable
    || mazeLayout[rowA - 1][columnA] == GOAL)) {
    mazeLayout[rowA][columnA] = spaceUsed;
    mazeLayout[rowA - 1][columnA] = ADA;
    this.rowAda = rowA - 1;
    this.columnAda = columnA;
    validMove = true;
    countAdasMoves++;
    /** if Charles is moving left, then check if he can make the move */
    if (move == 'J'&& (mazeLayout[rowC][columnC - 1] == spaceAvailable
    || mazeLayout[rowC][columnC - 1] == GOAL)) {
    mazeLayout[rowC][columnC] = spaceUsed;
    mazeLayout[rowC][columnC -1] = CHARLES;
    this.rowCharles = rowC;
    this.columnCharles = columnC - 1;
    validMove = true;
    countCharlesMoves++;
    /** if Charles is moving down, then check if he can make the move */
    if (move == 'K'&& (mazeLayout[rowC + 1][columnC] == spaceAvailable
    || mazeLayout[rowC + 1][columnC] == GOAL)) {
    mazeLayout[rowC][columnC] = spaceUsed;
    mazeLayout[rowC + 1][columnC] = CHARLES;
    this.rowCharles = rowC + 1;
    this.columnCharles = columnC;
    validMove = true;
    countCharlesMoves++;
    /** if Charles is moving right, then check if he can make the move */
    if (move == 'L'&& (mazeLayout[rowC][columnC + 1] == spaceAvailable
    || mazeLayout[rowC][columnC + 1] == GOAL)) {
    mazeLayout[rowC][columnC] = spaceUsed;
    mazeLayout[rowC][columnC + 1] = CHARLES;
    this.rowCharles = rowC;
    this.columnCharles = columnC + 1;
    validMove = true;
    countCharlesMoves++;
    /** if Charles is moving up, then check if he can make the move */
    if (move == 'I'&& (mazeLayout[rowC - 1][columnC] == spaceAvailable
    || mazeLayout[rowC - 1][columnC] == GOAL)){
    mazeLayout[rowC][columnC] = spaceUsed;
    mazeLayout[rowC - 1][columnC] = CHARLES;
    this.rowCharles = rowC - 1;
    this.columnCharles = columnC;
    validMove = true;
    countCharlesMoves++;
    return validMove;
    * This method indicates whether the current maze configuration is a winning
    * configuration for either player or not.
    * Return 1 if Ada won
    * Return 2 if Charles won
    * Return 0 if neither won
    * @return int won: Indicates who won the game (1 or 2) or no one won the
    * game (0)
    public static int hasWon() {
    int won = 0;
    /** if location of Goal's row and column equals Ada's then she won */
    if (rowGoal == rowAda && columnGoal == columnAda){
    won = 1;
    /** if location of Goal's row and column equals Charles's then he won */
    if (rowGoal == rowCharles && columnGoal == columnCharles){
    won = 2;
    /** if both players are away from the Goal then no one won */
    if ((rowGoal != rowAda && columnGoal != columnAda) &&
    (rowGoal != rowCharles && columnGoal != columnCharles)) {
    won = 0;
    return won;
    * This method indicates whether in the current maze configuration both
    * players are caught in dead ends.
    * @return deadEnd: boolean value true if both players can't make a valid
    * move, false otherwise
    public static boolean isBlocked(){
    boolean deadEnd = false;
    /** Check if Ada & Charles are blocked */
    if (((mazeLayout[rowAda][columnAda - 1] == wall
    || mazeLayout[rowAda][columnAda - 1] == spaceUsed
    || mazeLayout[rowAda][columnAda - 1] == CHARLES)
    && (mazeLayout[rowAda][columnAda + 1] == wall
    || mazeLayout[rowAda][columnAda + 1] == spaceUsed
    || mazeLayout[rowAda][columnAda + 1] == CHARLES)
    && (mazeLayout[rowAda + 1][columnAda] == wall
    || mazeLayout[rowAda + 1][columnAda] == spaceUsed
    || mazeLayout[rowAda + 1][columnAda] == CHARLES)
    && (mazeLayout[rowAda - 1][columnAda] == wall
    || mazeLayout[rowAda - 1][columnAda] == spaceUsed
    || mazeLayout[rowAda - 1][columnAda] == CHARLES))
    && ((mazeLayout[rowCharles][columnCharles - 1] == wall
    || mazeLayout[rowCharles][columnCharles - 1] == spaceUsed
    || mazeLayout[rowCharles][columnCharles - 1] == ADA)
    && (mazeLayout[rowCharles][columnCharles + 1] == wall
    || mazeLayout[rowCharles][columnCharles + 1] == spaceUsed
    || mazeLayout[rowCharles][columnCharles + 1] == ADA)
    && (mazeLayout[rowCharles + 1][columnCharles] == wall
    || mazeLayout[rowCharles + 1][columnCharles] == spaceUsed
    || mazeLayout[rowCharles + 1][columnCharles] == ADA)
    && (mazeLayout[rowCharles - 1][columnCharles] == wall
    || mazeLayout[rowCharles - 1][columnCharles] == spaceUsed
    || mazeLayout[rowCharles - 1][columnCharles] == ADA))) {
    deadEnd = true;
    return deadEnd;
    * This method returns an integer that represents the number of moves Ada
    * has made so far. Only legal moves are counted.
    * @return int numberOfAdasMoves: number of moves Ada has made so far
    public static int numAdaMoves() {
    return countAdasMoves;
    * This method returns an integer that represents the number of moves Charles
    * has made so far. Only legal moves are counted.
    * @return int numberOfCharlesMoves: number of moves Charles has made so far
    public static int numCharlesMoves() {
    return countCharlesMoves;
    * This method returns a 2D array of characters that represents the current
    * configuration of the maze
    * @return mazeLayout: 2D array that represents the current configuration
    * of the maze
    public static char[][] getGrid() {
    return mazeLayout;
    * This method compares contents of this MazeRace object to given MazeRace.
    * The two will not match if:
    * o the two grids have different dimensions
    * o the two grids have the same dimensios but positions of walls, players or
    * goal differs.
    * @param MazeRace: MazeRace object is passed in and compared with the given
    * MazeRace grid
    * @return boolean mazeEqual: true if both grids are same, false otherwise
    public static boolean equals(char[][] mr) {
    boolean mazeEqual = true;
    /** If the length of the arrays differs, then they are not equal */
    if (mr.length != mazeLayout.length || mr[0].length != mazeLayout[0].length){
    mazeEqual = false;
    } else {
    /** If lengths are same, then compare every element of the array to other */
    int count = 0;
    int row = 0;
    int column = 0;
    while( count < mr.length && mazeEqual) {
    if( mr[row][column] != mazeLayout[row][column]) {
    mazeEqual = false;
    count = count + 1;
    row = row + 1;
    column = column + 1;
    return mazeEqual;
    * This method represents the current state of the maze in a string form
    * @return string mazeString: string representation of the maze configuration
    public String toString() {
    String mazeString = "";
    for (int row = 0; row < mazeLayout.length; row++){
    for (int column = 0; column < mazeLayout[0].length; column++){
    mazeString = mazeString + mazeLayout[row][column];
    mazeString = mazeString + "\n";
    return mazeString.trim();
    The following is the Driver class: MazeRaceDriver
    import javax.swing.*;
    import java.io.*;
    * This class is the starting point for the maze race game. It is invoked
    * from the command line, along with the location of the layout file and
    * the desired interface type. Its main purpose is to initialize the
    * components needed for the game and the specified interface.
    public class MazeRaceDriver {
    * A method that takes a text file representation of the maze and
    * produces a 2D array of characters to represent the same maze.
    * @param layoutFileName location of the file with the maze layout
    * @return The maze layout.
    public static char[][] getLayoutFromFile( String layoutFileName )
    throws IOException {
    BufferedReader br = new BufferedReader(new FileReader(layoutFileName));
    String s = br.readLine();
    int r = 0; // start at row 1
    int c = s.length(); // initialize column to the length of the string
    while(s != null){
    r++;
    s = br.readLine();
    char[][]grid = new char[r][c];
    // this part, gets the text file into a char array
    BufferedReader brr = new BufferedReader(new FileReader(layoutFileName));
    String ss = brr.readLine();
    int row = 0;
    while(ss != null){
    for(int col = 0; col < c; col++){
    grid[row][col] = ss.charAt(col);
    row++;
    ss = brr.readLine();
    return grid;
    * The main method of your program.
    * @param args command-line arguments provided by the user
    public static void main( String[] args ) throws IOException {
    // check for too few or too many command line arguments
    if ( args.length != 2 ) {
    System.out.println( "Usage: " +
    "java MazeRaceDriver <location> <interface type>" );
    return;
    if ( args[1].toLowerCase().equals( "text" ) ) {
    char[][] layout = getLayoutFromFile( args[0] );
    MazeRace maze = new MazeRace( layout );
    MazeRaceTextUI game = new MazeRaceTextUI( maze );
    game.startGame();
    else if ( args[1].toLowerCase().equals( "gui" ) ) {
    // Get the filename using a JFileChooser
    // read the layout from the file
    // starting the window-based maze game
    JFileChooser chooser = new JFileChooser("");
    int returnVal = chooser.showOpenDialog(null);
    if (returnVal == JFileChooser.APPROVE_OPTION) {
    BufferedReader br =
    new BufferedReader(new FileReader(chooser.getSelectedFile()));
    String inputLine = br.readLine();
    while (inputLine != null) {
    System.out.println(inputLine);
    inputLine = br.readLine();
    char[][] layout = getLayoutFromFile( args[0] );
    MazeRace maze = new MazeRace( layout );
    MazeRaceWindow game = new MazeRaceWindow( maze );
    game.startGame();
    } else {
    System.out.println("Cancel was selected");
    } else {
    System.out.println( "Invalid interface for game." +
    " Please use either TEXT or GUI." );
    return;
    The following is the MazeRaceWindow class
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.io.*;
    * This class is responsible for displaying the maze race game. It should
    * set up the maze window when the game is started and update the display
    * with each move.
    public class MazeRaceWindow extends JFrame {
    private JLabel[][] mazeLabel;
    private JFrame mazeFrame;
    * Reference to the underlying MazeRace object which needs to be
    * updated when either player moves
    private MazeRace maze;
    * Class constructor for the GUI object
    * @param maze the underlying MazeRace object
    public MazeRaceWindow( MazeRace maze ) {
    this.maze = maze;
    System.out.println(maze);
    mazeFrame = new JFrame();
    mazeFrame.setSize(200,200);
    Container content = mazeFrame.getContentPane();
    System.out.println(content);
    content.setLayout(new GridLayout(.length, mazeLayout[0].Length));
    for (int i = 0; i < MazeRace.length; i++ ) {
    for (int j = 0; j < MazeRace[0].length; j++ ) {
    mazeLabel = new JLabel[MazeRace.rowLength][MazeRace.columnLength];
    content.add(mazeLabel[i][j]);
    System.out.println(mazeLabel[i][j]);
    mazeFrame.pack();
    mazeFrame.setVisible(true);
    //content.add(mazeLabel);
    //mazeFrame.addKeyListener(this);
    * A method to be called to get the game running.
    public void startGame() throws IOException {
    System.out.println();
    /* loop to continue to accept moves as long as there is at least one
    * player able to move and no one has won yet
    while ( !maze.isBlocked() && maze.hasWon() == 0 ) {
    // prints out current state of maze
    System.out.println( maze.toString() );
    System.out.println();
    // gets next move from players
    System.out.println("Next move?");
    System.out.print("> ");
    BufferedReader buffer =
    new BufferedReader( new InputStreamReader( System.in ) );
    String moveText = "";
    moveText = buffer.readLine();
    System.out.println();
    // note that even if a string of more than one character is entered,
    // only the first character is used
    if ( moveText.length() >= 1 ) {
    char move = moveText.charAt( 0 );
    boolean validMove = maze.move( move );
    // The game has finished, so we output the final state of the maze, and
    // a message describing the outcome.
    System.out.println( maze );
    int status = maze.hasWon();
    if ( status == 1 ) {
    System.out.println( "Congratulations Ada! You won the maze in "
    + maze.numAdaMoves() + " moves!" );
    } else if ( status == 2 ) {
    System.out.println( "Congratulations Charles! You won the maze in "
    + maze.numCharlesMoves() + " moves!" );
    } else {
    System.out.println( "Stalemate! Both players are stuck. "
    + "Better luck next time." );
    The following is the Listener class: MazeRaceListener
    import java.awt.event.*;
    import java.awt.*;
    import javax.swing.*;
    /** Listens for keystrokes from the GUI interface to the MazeRace game. */
    public class MazeRaceListener extends KeyAdapter {
    * Reference to the underlying MazeRace object which needs to be updated
    * when either player moves
    private MazeRace maze;
    * Reference to the MazeRaceWindow object that displays the state of
    * the game
    private MazeRaceWindow mazeWindow;
    * Class constructor for the key listener object
    * @param maze the underlying MazeRace object
    public MazeRaceListener( MazeRace maze ) {
    this.maze = maze;
    * A method that sets which JFrame will display the game and need to be
    * updated with each move.
    * @param window the JFrame object that displays the state of the game
    public void setMazeRaceWindow( MazeRaceWindow window ) {
    mazeWindow = window;
    * A method that will be called each time a key is pressed on the active
    * game display JFrame.
    * @param event contains the pertinent information about the keyboard
    * event
    public void keyTyped( KeyEvent event ) {
    char move = event.getKeyChar();
    // TODO: complete method so that the appropriate action is taken
    // in the game
    //mazeLabel.setText(String.valueOf(move).toUpperCase());
    }

    and listen to the keys (A,S,D,W & J,K,L,I) and make the move accordingly [url http://java.sun.com/docs/books/tutorial/uiswing/misc/keybinding.html]How to Use Key Bindings

  • GUI layout

    I am wondering how this can be implemented:
    I have a layout which includes a checkbox, whenever the checkbox is checked, another Panel is appended to the GUI, if checkbox is unchecked, that appended Panel simply hides/disappears.
    An example of this can be:
    [ ] would you like to leave a comment?
    if user checks the checkbox, the GUI changes to:
    [x] would you like to leave a comment?
    Your comments:
    (a textarea follow with some send button at the bottom)
    Another example:
    orig:
    |----------------------------------|
    |This is My GUI                             |
    |[ ] check here to see more.           |
    |----------------------------------|now:
    |----------------------------------|
    |This is My GUI after appending       |
    |[ x ] check here to see more         |
    |more GUI is appended here.           |
    |   ( ** )                                     |
    |----------------------------------|

    You can use a BoxLayout on a JPanel. I have a little sample. Although it's not checkbox(I use JButtons). Click button0 will cause button2 added in the end of the panel, click button1 will remove button2.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    class scrolltest extends JFrame
         JButton[] b;
         JPanel panel;
         JScrollPane scroll;
         scrolltest()
              panel = new JPanel();
              panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
              b = new JButton[10];
              for (int i = 0; i < 10; i++)
                   b[i] = new JButton(String.valueOf(i));
                   if (i != 2)
                        panel.add(b);
              scroll = new JScrollPane(panel);
              b[0].addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent e)
                        panel.add(b[2]);
                        panel.invalidate();
                        panel.validate();
                        panel.repaint();
                        scroll.invalidate();
                        scroll.validate();
                        scroll.repaint();
              b[1].addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent e)
                        panel.remove(b[2]);
                        panel.invalidate();
                        panel.validate();
                        panel.repaint();
                        scroll.invalidate();
                        scroll.validate();
                        scroll.repaint();
              getContentPane().add(scroll);
              setBounds(0, 0, 80, 80);
              setVisible(true);
         public static void main(String[] args)
              scrolltest frame = new scrolltest();

  • Can't run java program with GUI

    My computer can run java program properly.
    However, for those program with GUI (using swing),
    my computer is unable to display the GUI.
    What's wrong with it? Is there any PATH I need to set before running GUI program?
    Thanks
    icedgold

    Cut, copy, paste then compile and run this;-import java.awt.*;
    import javax.swing.*;
    public class MyJFrame extends JFrame {
      public MyJFrame() {
          super("My first JFrame");
          Container c  = getContentPane();
          JPanel panel = new JPanel();
          panel.setBackground(Color.white);//  (new Color(255, 255, 255));
          JLabel jl = new JLabel("Yes it works");
          panel.add(jl);     
          c.add(panel);
      public static void main(String[] args) {
        MyJFrame frame = new MyJFrame();
        frame.setSize(180,120);
        frame.setLocation(200, 300);
        frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
        frame.setVisible(true);
    }

  • Running my Java application in GUI

    Hello,
    I have created this method to execute my java files(.class files) from the GUI when I click on a button. But I dont know what problem is in my code. Could any one please check my code and correct me if I am wrong? When I execute my code, I get into the exception of my first catch block.
    File file;
    JTextArea compileArea;
    String command,runClassCommand,classpath;
         public void runClass(String file1)
              command = runClassCommand;
              String classname = file.getPath(),fileName = file.getName();
              //classname=file.substring(file.lastIndexOf(File.separator)+1,file.length()-5);          
              classpath=file1.substring(0,file1.lastIndexOf(File.separator));
              //start();
              try
         //p = Runtime.getRuntime().exec(command +"-classpath "+"\""+classpath+"\" "+classname);
                   p = Runtime.getRuntime().exec(command +classname);
              catch(Exception e)
                   compileArea.append("\nFailed to execute java.exe " + "check the directory and try again");
                   return;     
              try
                   BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));               
                   while(true)
                        String line = br.readLine();
                        if     (line == null)
                             br.close();
                             break;
                        else if(line.length() > 0)
                             compileArea.append("\nSystem: " + line + '\n');
                   p.destroy();
              catch(Exception e)
                   compileArea.append("\nRedirecting System.out failed");
                   p.destroy();
              compileArea.append('\n' + "Exception in thread [main] java.lang.NoClassDefFoundError: "+classname);
    Thanks

    Could you post the text of the Exception, and the rest of your code, or at least the rest of this class ? Without it, it's impossible to determine exactly what went wrong.
    However, I would guess that the command you're passing is probably invalid. If possible could you print that and add it as well ?
    Dave.

  • Newbie- Java simply put, isn't to me

    I am totally ignorant about computers & how they work. All I know is the problems that I have when I turn on my PC. For instance, the other night I was at a web site and I was playing a game. The next thing I know is I got dropped from the game & I saw this message, "java script error". I didn't know what it meant and I still don't. I went to my find menu and typed in, java, just to see what i'd find. What I found is too confusing for me to understand.
    What I would like to know is, obviously Java does exist in my PC, but is it possible that somehow it got corrupted in some way that caused me to get that error message? I would also like to know in detail how I can determine what version of Java do I have & if need be, how do I go about upgrading to a newer version. As I said, I'm totally lost when it comes to computers and at this point I'm not even sure if this forum is where I need to be. Any reasonable suggestions or help would be greatly appreciated by this "newbie"

    Hello there,
    If I may say so, if you can create a file (SOME file) in any given programme and save it to any given folder on any of your hard disks, and the next day still remember what sort of file you created and where you put it - then you know a lot more about computers than a coupla folks I know (includes my mother :-) )!
    Well I don't know how much you know, so I reckon if you consider yourself "ignorant about computers" then maybe it's not a very good idea to start getting interested in java. I mean it's pretty hard if you simply lack some basics on a topic and then all of a sudden try to become specific. I know myself... I bought my computer because I needed to record a music demo and thought this would be the easiest way to ensure ok quality and the ability to do the recording any time I like myself. It took aaaaaages for me to get the computer to do what I wanted it to... but I needed the basics. And I think if it hadn't been so important to me (and besides I'm very curious about computers on a very broad basis), I would have given up and turned to other things to spend so much time on. But that's something you have to know yourself. If you're really interested, you'll find out. But be assured, it's gonna cost you hours on hours, half of your nights, you'll get square eyes, and if you're not keen on reading then you better not go further. :-)
    Anyway... I kinda felt like writing this :-)
    So long
    fla~

  • Opening java files to GUI

    I am creating a program to open a java file to the GUI
    I want to have a filechooser which will open the file to a text display of the GUI. How do i get to open the file and the display goes to the Text area (GUI).

    import java.awt.*;
    import javax.swing.*;
    import java.io.*;
    import java.awt.event.*;
    public class Frame1
        extends JFrame {
      JPanel panel1 = new JPanel();
      BorderLayout borderLayout1 = new BorderLayout();
      JMenuBar jMenuBar1 = new JMenuBar();
      JMenu jMenu1 = new JMenu();
      JMenuItem jMenuItem1 = new JMenuItem();
      JScrollPane jScrollPane1 = new JScrollPane();
      JTextArea jTextArea1 = new JTextArea();
      JMenuItem jMenuItem2 = new JMenuItem();
      public Frame1(String title) {
        super(title);
        try {
          jbInit();
          pack();
        catch (Exception ex) {
          ex.printStackTrace();
      public Frame1() {
        this("");
      private void jbInit() throws Exception {
        panel1.setLayout(borderLayout1);
        jMenu1.setMnemonic('F');
        jMenu1.setText("File");
        jMenuItem1.setMnemonic('O');
        jMenuItem1.setText("Open");
        jMenuItem1.addActionListener(new Frame1_jMenuItem1_actionAdapter(this));
        jTextArea1.setText("jTextArea1");
        jMenuItem2.setMnemonic('E');
        jMenuItem2.setText("Exit");
        jMenuItem2.addActionListener(new Frame1_jMenuItem2_actionAdapter(this));
        getContentPane().add(panel1);
        panel1.add(jScrollPane1, BorderLayout.CENTER);
        jScrollPane1.getViewport().add(jTextArea1, null);
        jMenuBar1.add(jMenu1);
        jMenu1.add(jMenuItem1);
        jMenu1.add(jMenuItem2);
        setJMenuBar(jMenuBar1);
        setDefaultCloseOperation(JDialog.EXIT_ON_CLOSE);
      public static void main(String[] args) {
        Frame1 f = new Frame1();
        f.setLocation(50, 50);
        f.setSize(new Dimension(640, 480));
    //    dlg.pack();
        f.show();
      void jMenuItem2_actionPerformed(ActionEvent e) {
        System.exit(0);
      void jMenuItem1_actionPerformed(ActionEvent e) {
        JFileChooser jfc = new JFileChooser(System.getProperty("user.home"));
        jfc.setFileFilter(
            new javax.swing.filechooser.FileFilter() {
           * Whether the given file is accepted by this filter.
          public boolean accept(File f) { return f.isDirectory() || f.getName().endsWith("java"); }
           * The description of this filter. For example: "JPG and GIF Images"
           * @see FileView#getName
          public String getDescription() { return "Java sourcer file (*.java)"; }
        jfc.showOpenDialog(this);
        File f = jfc.getSelectedFile();
        if (f != null) {
          FileInputStream fis = null;
          byte[] buf = null;
          try {
            fis = new FileInputStream(f);
            buf = new byte[fis.available()];
            fis.read(buf);
            jTextArea1.setText(new String(buf));
            jTextArea1.setCaretPosition(0);
          catch (Exception ex) {
            JOptionPane.showMessageDialog(this, ex.toString(), "Error Reading File", JOptionPane.ERROR_MESSAGE);
          finally {
            if (fis != null) {
              try {
                fis.close();
              catch (IOException ex1) {
    class Frame1_jMenuItem2_actionAdapter
        implements java.awt.event.ActionListener {
      Frame1 adaptee;
      Frame1_jMenuItem2_actionAdapter(Frame1 adaptee) {
        this.adaptee = adaptee;
      public void actionPerformed(ActionEvent e) {
        adaptee.jMenuItem2_actionPerformed(e);
    class Frame1_jMenuItem1_actionAdapter
        implements java.awt.event.ActionListener {
      Frame1 adaptee;
      Frame1_jMenuItem1_actionAdapter(Frame1 adaptee) {
        this.adaptee = adaptee;
      public void actionPerformed(ActionEvent e) {
        adaptee.jMenuItem1_actionPerformed(e);
    }

  • JDev 10.1.3.1 + Java 1.6 - GUI Problems

    Hi All,
    since adding Java 1.6 to my project libraries - the GUI developer has been acting strangely. In particular toolbars refuse to display any command buttons placed on them. But when I run the application, they buttons are all visible.
    If I add several buttons to the toolbar using the GUI developer, they are visible. If I then rebuild the form - the buttons vanish. If I run the application, the buttons are visible.
    Any ideas
    TIA
    Bill
    -

    After further analysis it appears that if I duplicate an existing JInternalFrame that doesn't display the command butttons on the toolbar (using the GUI designer) and just start removing code, eventually the buttons will be displayed. (the buttons are always correctly displayed during either debug execution or normal execution). If I then start putting code back, I can reach a 'toggle point' - remove a single class = buttons are displayed, add the class back = buttons 'disappear'. (There being no other references to the class being added/removed)
    I tried increasing the memory options - but that had no effect.
    So what next ? - the application is a MDI with 100+ JInternalFrames - (most of which have associated JTables + DB access). It's currently packaged as a single Jar.
    TIA
    Bill

  • XP Newbie Java P. & JRE Confusion Updates & Error

    Hi!
    I posted this in TechArena, and received a post in reply that suggested I should post here instead...
    I'm an eternal newbie with computers though I never stop trying to learn. I've looked through many posts & don't see an answer to my questions, so I hope this is the right place to ask them.
    I have a Dell Inspiron 1300 laptop with XP Home v. 5.1.266. I use Firefox and AVG. My computer was getting slow and in the last few days some programs started crashing. Today Corel Photo Album crashed. In trying to google the error report I found something mentioned about Java needing old versions deleted, so I checked mine. And this is where I got confused.
    Firest of all, I don't understand what the difference is between "Java Platform" and Java Runtime Environment" and I don't understand which version I should have of each. What I do have is:
    Java 2 Runtime Environment, SE v1.4.2_03
    Java ™ 6 Update 14
    Version 6.0.140
    Java ™ 6 Update 7
    Version 1.6.0.70
    Could someone one tell me what I should have on my computer?
    Also, I read in a post that one shouldn't install an update until the old versions are deleted, yet in another post (somewhere) it said to update and then delete the old versions. I don't know which to believe. Could I get some advice on which is correct?
    Thank you very much!
    dorij

    Thanks for the advice. I did what you said. Then Spybot did a whole scan which took a while. When it returned the computer to me, all the versions of Java were gone from Add/Delete programs. I decided to do a search on "java" just to see what came up. A huge list came up; things like Java Plug.doc, java_install_reg.log, a folder labeled javaws thats located in Sun\Java\Deployment. I'd copy the list, but I don't know how. There are about 89 items on the list.
    Should these files be there? I haven't yet reinstalled the correct update.
    Thanks again.
    dorij

Maybe you are looking for