Split GUI to more classes?

I like to keep my classes small and focus on one thing. So to not make my GUI code messy I have split it in 2 parts. One with the frame(GUIFrame) initiates the other(WestPanel), which controls all my JButtons, JCheckBox etc. But when I wanna put my buttons to use by implementing ActionListeners(Created as inner classes in WestPanel) thats when I have a problem. I cant acces objects(sensorField) which I need to use, if my buttons are going to work. I understand the problem, but cant figure out the solution.
If all my GUI code was in the GUIFrame class I would have no problem, because that class has acces to the third class(SensorField), which have the data I need, but the class would then become big and messy. Whats the solution to this?
Looks like this:
WestPanel <- GUI -> SensorField

You may do well to check out online articles or books on the MVC pattern.

Similar Messages

  • Splitting GUI from Code

    Hi, I created a Tetris game and I didn't split GUI from code.
    but since I'm trying to learn from this I would like to split it.
    so I created 3 JPanels a controller and a JFrame in different classes.
    I think this is the best solution?
    now I have for example this piece of code in my Canvas TetrisBoard .paint method
    wich draws a TetrisBoard on the screen.
      public void paint(Graphics2D g) {
        Color color;
        for(int row = 0 ; row < rows ; row++)
          for(int col = 0 ; col < cols ; col++) {
            /* Get The Color for the current Position */
            switch(board[ row ][ col ]) {
              case Block.T_Block: color = Block.T_COLOR; break;
              case Block.I_Block: color = Block.I_COLOR; break;
              case Block.J_Block: color = Block.J_COLOR; break;
              case Block.L_Block: color = Block.L_COLOR; break;
              case Block.O_Block: color = Block.O_COLOR; break;
              case Block.S_Block: color = Block.S_COLOR; break;
              case Block.Z_Block: color = Block.Z_COLOR; break;
              default:color = Color.GRAY;
            g.setColor(color);
            /* Fill & Draw the rectangle with the given color from above. */
            g.fillRect(col*Block.TILE_SIZE, row*Block.TILE_SIZE, Block.TILE_SIZE,Block.TILE_SIZE);
            g.setColor(g.getColor().darker());
            g.drawRect(col*Block.TILE_SIZE, row*Block.TILE_SIZE, Block.TILE_SIZE,Block.TILE_SIZE);
    }How do I transfer this to my JPanel, controller class?
    The JPanel classes should they know about the board, or should they only containt the g.drawRect method. or something like this drawBoard(color, board, tile_size)
    so in general should the JPanel, controller classes contain any code not related to drawing. (KeyListeners, looping arrays...)
    Message was edited by:
    stef569

    You might want to have a look at implementations of the Model-view-controller (MVC) pattern as this may be a decent way to separate things out. Some reference sources include:
    http://en.wikipedia.org/wiki/Model-view-controller
    http://www.cs.cmu.edu/~pattis/15-1XX/15-200/lectures/modelinmvc/index.html
    http://www.stanford.edu/class/cs106a/handouts/43-mvc-example.pdf
    Also, I'm not sure about how to answer your specific question without looking at your code. It'd be great if you could post it, but this may not be feasible if it is large.

  • How to specify ");" as a regular expression in split method of String class

    How to specify ");" as a regular expression in split method of String class using delimeters?

    Sorry, you can't specify that by using delimiters. Mostly because this requirement makes no sense.
    Do you rather need "\\);"?

  • HT2506 Is it possible to print separate pages on the same sheet in preview. I would like to split a set of class power points to display Page 1 and 2 on the first page, page 3 and 4 on the second page etc. Thanks in advance!

    Is it possible to print separate pages on the same sheet in preview. I would like to split a set of class power points to display Page 1 and 2 on the first page, page 3 and 4 on the second page etc.
    Thanks in advance!

    Nevermind everyone!
    I got it to work with Print Down/Across...silly me.
    Thanks anyway!
    -Arin

  • Interfaces declare methods that one or more classes may or may not implemen

    Interfaces declare methods that one or more classes may or may not implement.
    true or false?

    Encephalopathic wrote:
    If you want to appear to be more than just someone scrounging for someone else to do their homeworkHe/she is what they is
    [http://forum.java.sun.com/thread.jspa?threadID=5292343]
    [http://forum.java.sun.com/thread.jspa?threadID=5283461]
    [http://forum.java.sun.com/thread.jspa?threadID=5283412]
    [http://forum.java.sun.com/thread.jspa?threadID=5279385]

  • Does making more classes or incapsulation effect perfoemance?

    I have a Frame with a TabbedPane on it. There are 8 tabs. Each tab contains a JTable with lots of fields & 4 buttons.
    When I design all this stuff in JBuilder all panels are put into one class (...Frame class). I want to put every tab's JPanel into a separate class (... JPanel class). But some say that it might decrease otherall performance. It's sounds like a nonsense to me. But I'm not experienced programmer. And I'd like to make it clear for myself.
    One more thing. If I'm setting all class fields private & then write get/set, is the field access slower in this case than if I'm making all fields public?
    Can anyone help me? Does anyone know what does really decrease perfomance & what does not?

    ...but some say that it might decrease otherall performance
    Having more classes does increase the time it takes a program to run because of the additional class loading activity. Deciding whether to create another class is one of the toughest things in o-o design, and it rests on whether the extra load time is worth it for readability and reusability. The overall impact is not that large if you are talking about five or ten classes.
    If I'm setting all class fields private & then write get/set, is the field access slower in this case than if I'm making all fields public?
    Yes it is, but it is pretty negligible, especially if you are just returning a value. The real advantage of get/set is to allow for additional processing to take place when a property is modified or queried.
    Mitch Goldstein
    Author, Hardcore JFC (Cambridge Univ Press)
    [email protected]

  • Employee  Split commission for more than one partner

    Hi
    any body help me..
    How to maintain sales employee split comission for more then one partners
    has to be sales employees assigned in sales document item level, and pricing condition types are created in same number as sales employes.

    You cannot do it in customizing, use a custom program.
    Roberto

  • How can I to control any element of my GUI from another class?

    How can I to control any element of my GUI from another class?

    For that, you need the external class to have the reference to your element.. If your idea is to change basic properties like width, height etc.. then you can have the constructor of the external class to take the object of the parent of your class as the parameter and modify ..
    However, if the properties to be altered/accessed are custom to your element, then you will have to have the class accept an object of your class as the parameter. No other option..
    What exactly is your requirement?

  • Need Help regarding separate GUI and logic class

    Hi,
    I was given this assignment and I'm stuck big time.
    Basically I have a GUI class for a stopwatch interface.
    public class WatchGui implements Gui{
        JButton b1, b2;
        JLabel minutes, symbol1, seconds, symbol2, hundredths;
        StopWatch stopwatch;
        public WatchGui(){
             stopwatch = new StopWatch();
             b1 = new JButton("RUN");
            minutes = new JLabel("00");
            ActionListener al = new MyActionListener(stopwatch);
            b1.addActionListener(al);
        //  Called to connect a watch to the GUI
        public void connect(Watch w) {
        public void setDisplay(String mm) {
             minutes.setText(mm);
        public void addComponentsToPane(Container pane) {
            pane.setLayout(null);
            pane.add(b1);
            pane.add(b2);
            pane.add(minutes);
            Insets insets = pane.getInsets();
        public void createAndShowGUI() {
            //Create and set up the window.
            JFrame frame = new JFrame("XXX");
            frame.setResizable(false);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            //Set up the content pane.
            WatchGui Pane = new WatchGui();
            Pane.addComponentsToPane(frame.getContentPane());
            //Size and display the window.
            Insets insets = frame.getInsets();
            frame.setVisible(true);
    }I have a watch class which function as the engine for the stop watch
    import java.awt.event.*;
    import javax.swing.*;
    class StopWatch implements Watch {
         WatchGui watchgui;
         public StopWatch() {
              running = false;
              count = 0;
        public void connect(Gui g) {
             watchgui = (WatchGui) g;
             watchgui.createAndShowGUI();
        public void runStop() {
             mm = String.valueOf("100");
         watchgui.setDisplay(mm);
    class MyActionListener implements ActionListener {
         StopWatch stopwatch;
         public MyActionListener(StopWatch stopwatch) {
              this.stopwatch = stopwatch;
         public void actionPerformed (ActionEvent e) {
              stopwatch.runStop();
    }To get the StopWatch to work, I have this driver class
    import java.lang.reflect.Constructor;
    public class Driver
        public static void main(String[] args)
          throws Exception
         if( args.length!=1 ){
             System.err.println("Usage: Driver WATCHNAME");
             System.exit(1);
             return;
         String watchName= args[0];
         Class cl= Class.forName(watchName,true,Thread.currentThread().getContextClassLoader());
         Constructor c[]= cl.getConstructors();
         if( c.length==0 ){
             System.err.println("There is NO constructor in your watch class");
             System.exit(1);
             return;
         if( c.length>1 ){
             System.err.println( "There is more than one constructor in your class");
             System.exit(1);
         //Construct the components
         Watch w=(Watch)c[0].newInstance(new Object[0]);
         Gui g= new WatchGui();
         //Connect them to each other
         g.connect(w);
         w.connect(g);
         //Reset the components()
         g.reset();
         w.reset();
         //And away we go...
         try{
             for(;;){
              Thread.sleep(10); //milliseconds
              w.tick();
         }catch(InterruptedException ie){
             System.exit(1);
    }My currently problem is that when i click on the button in the GUI, it will go to MyActionListener class and call the runStop method.
    public void runStop() {
         mm = String.valueOf("100");
         watchgui.setDisplay(mm);
    The problem is that when watchgui.setDisplay(mm) is called, exception is thrown instead. I'm suspecting it has something to do with the initialization of watchgui. Can anyone advice?

    import java.awt.*;
    import java.awt.event.ActionListener;
    import javax.swing.*;
    public class WatchGui implements Gui{
         JButton b1, b2;
        JLabel minutes, symbol1, seconds, symbol2, hundredths;
        StopWatch stopwatch;
        public WatchGui(){
             stopwatch = new StopWatch();
             b1 = new JButton("RUN/STOP");
            b2 = new JButton("  RESET  ");
            minutes = new JLabel("00");
            symbol1 = new JLabel(":");
            seconds = new JLabel("00");
            symbol2 = new JLabel(".");
            hundredths = new JLabel("00");
            minutes.setFont(new Font("Arial", Font.BOLD, 40));
            symbol1.setFont(new Font("Arial", Font.BOLD, 40));
            seconds.setFont(new Font("Arial", Font.BOLD, 40));
            symbol2.setFont(new Font("Arial", Font.BOLD, 20));
            hundredths.setFont(new Font("Arial", Font.BOLD, 20));
            ActionListener al = new MyActionListener(stopwatch);
            b1.addActionListener(al);
        //  Called to connect a watch to the GUI
        public void connect(Watch w) {
        //Called to reset the GUI
        public void reset() {
             minutes.setText("00");
             seconds.setText("00");
             hundredths.setText("00");
        //Called whenever the value displayed by the watch changes
        public void setDisplay(String mm, String ss, String hh) {
             minutes.setText(mm);
             seconds.setText(ss);
             hundredths.setText(hh);
        public void addComponentsToPane(Container pane) {
            pane.setLayout(null);
            pane.add(b1);
            pane.add(b2);
            pane.add(minutes);
            pane.add(symbol1);
            pane.add(seconds);
            pane.add(symbol2);
            pane.add(hundredths);
            Insets insets = pane.getInsets();
            Dimension size = b1.getPreferredSize();
            b1.setBounds(50 + insets.left, 20 + insets.top,
                         size.width, size.height);
            size = b2.getPreferredSize();
            b2.setBounds(150 + insets.left, 20 + insets.top,
                         size.width, size.height);
            size = minutes.getPreferredSize();
            minutes.setBounds(75 + insets.left, 70 + insets.top,
                    size.width, size.height);
            size = symbol1.getPreferredSize();
            symbol1.setBounds(120 + insets.left, 70 + insets.top,
                    size.width, size.height);
            size = seconds.getPreferredSize();
            seconds.setBounds(135 + insets.left, 70 + insets.top,
                    size.width, size.height);
            size = symbol2.getPreferredSize();
            symbol2.setBounds(182 + insets.left, 87 + insets.top,
                    size.width, size.height);
            size = hundredths.getPreferredSize();
            hundredths.setBounds(190 + insets.left, 87 + insets.top,
                    size.width, size.height);
        public void createAndShowGUI() {
            //Create and set up the window.
            JFrame frame = new JFrame("StopWatch");
            frame.setResizable(false);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            //Set up the content pane.
            WatchGui Pane = new WatchGui();
            Pane.addComponentsToPane(frame.getContentPane());
            //Size and display the window.
            Insets insets = frame.getInsets();
            frame.setSize(300 + insets.left + insets.right,
                          150 + insets.top + insets.bottom);
            frame.setVisible(true);
    import java.awt.event.*;
    import javax.swing.*;
    class StopWatch implements Watch {
         WatchGui watchgui;
         long startTime;
         boolean running;
         javax.swing.Timer timer;
         String mm, ss, hh;
         int count, tmp;
         public StopWatch() {
              running = false;
              count = 0;
              timer = new javax.swing.Timer(1000, new ActionListener()
                   public void actionPerformed(ActionEvent e)
                         count++;
                         mm = String.valueOf(count);
                         ss = String.valueOf(count);
                         hh = String.valueOf(count);
                         watchgui.setDisplay(mm, ss, hh);
        //Called to connect the GUI to watch
        public void connect(Gui g) {
             watchgui = (WatchGui) g;
             watchgui.createAndShowGUI();
              //watchgui.setDisplay(mm, ss, hh);
        //Called to initialise the watch
        public void reset() {
             watchgui.reset();
        //Called to deliver a TICK to the watch
        public void tick() {
        //Called whenever the run/stop button is pressed
        public void runStop() {
             int a = 33;
             mm = "" + a;
              ss = "" + a;
              hh = "" + a;
              watchgui.setDisplay(mm, ss, hh);
             if (running == false) {
                  count = 0;
                  timer.start();
                  running = true;
             }else {
                  timer.stop();
                  running = false;
        //Called whenever the lap/reset button is pressed
        public void lapReset() {}
    class MyActionListener implements ActionListener {
         StopWatch stopwatch;
         public MyActionListener(StopWatch stopwatch) {
              this.stopwatch = stopwatch;
         public void actionPerformed (ActionEvent e) {
              stopwatch.runStop();
    import java.lang.reflect.Constructor;
    public class Driver
        public static void main(String[] args)
          throws Exception
         if( args.length!=1 ){
             System.err.println("Usage: Driver WATCHNAME");
             System.exit(1);
             return;
         String watchName= args[0];
         Class cl= Class.forName(watchName,true,Thread.currentThread().getContextClassLoader());
         Constructor c[]= cl.getConstructors();
         if( c.length==0 ){
             System.err.println("There is NO constructor in your watch class");
             System.exit(1);
             return;
         if( c.length>1 ){
             System.err.println( "There is more than one constructor in your class");
             System.exit(1);
         //Construct the components
         Watch w=(Watch)c[0].newInstance(new Object[0]);
         Gui g= new WatchGui();
         //Connect them to each other
         g.connect(w);
         w.connect(g);
         //Reset the components()
         g.reset();
         w.reset();
         //And away we go...
         try{
             for(;;){
              Thread.sleep(10); //milliseconds
              w.tick();
         }catch(InterruptedException ie){
             System.exit(1);
    public interface Gui
        //Called to connect a watch to the GUI
        public void connect(Watch w);
        //Called to reset the GUI
        public void reset();
        //Called whenever the value displayed by the watch changes
        public void setDisplay(String mm, String ss, String hh);
    interface Watch
        //Called to connect the GUI to watch
        public void connect(Gui g);
        //Called to initialise the watch
        public void reset();
        //Called to deliver a TICK to the watch
        public void tick();
        //Called whenever the run/stop button is pressed
        public void runStop();
        //Called whenever the lap/reset button is pressed
        public void lapReset();
    }

  • Good practices with GUI? (deriving classes)

    Hello!
    I wonder if it is good practice to have the GUI in the
    init()-class, or superclass in an Applet? I have an applet with the GUI in the init(), and all events in the GUI is passed to it's child-class, named Manager. What about listeners, should they be in a class of their own?
    I am missing these guidelines in the tutorial, they don't tend to stress it, even though I think it is important for us newbies.

    hi,
    most times it is not really good to have listeners in own classes, because the job of many listeners is to invoke special algorithms which are mostly implemented in the class of the component, that owns the event. If you implement the listener in an own class, these class have to know the class, which hold the component an so you get an overhead of instances, you not really need.
    Another point you have to see is the object-oriented view on things:
    You only implement own classes, if they have a special use and can be used for more than one object, but most listeners doesn't fullfill this purpose, they are just needed for a special object and cannot be used for an other than this one.
    regards

  • Implimenting GUI into main class

    Hello all, I'm trying to figure out how to create a GUI for a program I'm writing.
    Basically, the program I'm making allows a user to search through a list of movies that have been entered into a database (a textfile). The movie objects have a Title, Description, Genre, and a Rating.
    I'm a little confused as to how I should set up all my code. I've written most of the background code to sort and search the movie objects, and I've also written most of the code to display the GUI. I just don't really know how to link them both.
    Here's my question. I have a GUI class that currently has a main method, which calls run(), which then calls createAndShowGUI(), a method of the GUI class. Is this the right way to do things?
    I also have a MovieSorter class, which creates an ArrayList of movieObjects, with the information taken from the text file. Unfortunatly, this too has a main method. So right now I can run the program from either class, to get the GUI to display, or to get the functional program to run. I don't know how to combine them.
    I'm assuming I will have the main method be in the MovieSorter class, that will call the createAndShowGUI method, which will then display the GUI. Then the GUI listens for any input (buttons, etc) and calls the appropriate methods accordingly. Is this right?
    I guess my main question is am I supposed to have a GUI object that I somehow put inside a JFrame (the GUI object being a JPanel or something)? I don't really know how the program is supposed to flow.
    Thanks!
    EDIT I can attach the code if you like, but it's a bit long.
    Edited by: lifeismusic434 on Oct 22, 2008 6:57 PM

    My take on something like this is that I look on the GUI as the View, and the non-GUI class as the Model. I suppose the program will be started by some Control object that will start up the GUI and start up the Model and link the two. Without more specifics, I'm afraid that that's the best that I can do. Hopefully someone else will give you more helpful advice.

  • Help with GUI (calling one class from other class)

    Hi everybody,
    I am new at GUI and I need your help..
    I have a JPanel, named "holdAll", layout of which is set to BorderLayout. I have implemented all other JPanels in different class files. For example, I have TopPanel, LeftPanel, etc. as shown below
    LeftPanel myLeft = new LeftPanel();
    holdAll.add(myLeft, BorderLayout.WEST);
    RightPanel myRight = new RightPanel();
    holdAll.add(myRight, BorderLayout.EAST);
    TopPanel myTop = new TopPanel();
    holdAll.add(myTop, BorderLayout.NORTH);
    MiddlePanel myMiddle = new MiddlePanel();
    holdAll.add(myMiddle, BorderLayout.CENTER);
    BottomPanel myBottom = new BottomPanel();
    holdAll.add(myBottom, BorderLayout.SOUTH);
    That works well but I have difficulties in ActionListeners.. For example, in my TopPanel class I have the code below:
    public void actionPerformed(ActionEvent e) {
    if (e.getSource() == btnInsert) {
    int returnVal = fc.showOpenDialog(fc);
    if (returnVal == JFileChooser.APPROVE_OPTION) {
    File file = fc.getSelectedFile();
    myImage newImage = new myImage(file);
    System.out.println(newImage.myHashCode());
    Here, if I have upload new image, then I have to update the listImage in the LeftPanel class.. But, I could not access the lstImage object in the LeftPanel class from the actionListener event in the TopPanel class.
    What should I do? Is my design poor?

    public class TopPanel extends JPanel implements ActionListener { //it doesn't allow "extends JPanel, Observable"
    JFileChooser fc;
    JButton btnInsert;
    JButton btnDelete;
    public TopPanel() {
    setLayout(new FlowLayout());
    setBorder(BorderFactory.createBevelBorder(1, Color.WHITE, Color.GRAY));
    btnInsert = new JButton("Insert");
    btnDelete = new JButton("Delete");
    JLabel myLabel = new JLabel(" Search : ");
    JTextField txtSearch = new JTextField();
    txtSearch.setColumns(20);
    JToolBar searchToolBar = new JToolBar();
    fc = new JFileChooser();
    btnInsert.addActionListener(this);
    searchToolBar.add(btnInsert);
    searchToolBar.add(btnDelete);
    searchToolBar.add(myLabel);
    searchToolBar.add(txtSearch);
    add(searchToolBar);
    public void actionPerformed(ActionEvent e) {
    if (e.getSource() == btnInsert) {
    int returnVal = fc.showOpenDialog(fc);
    if (returnVal == JFileChooser.APPROVE_OPTION) {
    File file = fc.getSelectedFile();
    *//Here I want to send fc.GetName() to the JList in the LeftPanel*
    my LeftPanel class is below:
    public class LeftPanel extends JPanel{
    public LeftPanel(){
    this.setLayout(new BorderLayout());
    setBorder(BorderFactory.createBevelBorder(1, Color.WHITE, Color.GRAY));
    JPanel pnlButtons = new JPanel();
    JButton btnName = new JButton("Name");
    JButton btnSize = new JButton("Size");
    JButton btnDate = new JButton("Date");
    pnlButtons.add(btnName);
    pnlButtons.add(btnSize);
    pnlButtons.add(btnDate);
    pnlButtons.setBorder(BorderFactory.createLineBorder(Color.BLACK));
    JPanel pnlImage = new JPanel();
    JList lstImage = new JList();
    lstImage.setVisible(true);
    pnlImage.add(new JScrollPane(lstImage));
    add(pnlButtons, BorderLayout.NORTH);
    add(pnlImage, BorderLayout.CENTER);
    Is there any simple way?

  • Good practice on passing GUI information to classes?

    I'm totally new to GUI programming suing java and swing components. So far I have onlu done GUI programming with old fashoned C-style approach.
    Anyway, I have a GUI built upon a tabbed pane, which holds alot of information. Every pane has components in it describing some characteritics that the user can modify.
    For ever pane I have also created a "processing" class, that will be responsible for processing the data entered in the the corresponding pane.
    Now I'm a little confused about how to continue this approach. The thing I wanna do is to get all the information entered in the GUI panes INTO the corresponding classes. One way is to create "set" methods for everything and call them from the GUI-class, but it will be ALOT of set methods then.
    Another way I was thinking about was if its possible to "send" the whole pane to the class, and then from the class that shall process the data, extract the data needed from the different components, and do its work?
    So, please, how is it best done in Java. Are there any good guidelines on how to do this kind of stuff? Any other good links or hint how to create GUI's in Java?
    Thanks in advance
    GF

    Big thanks for all input so far, but I am beginnig to doubt here, so please guide me back on the right path :)
    I'm starting to belive that this MVC approach might be little to ambitious for the task I'm supposed to fulfill. So far I took the MVC guide posted in one of the links above, created a simple GUI (mostly textfields) in Netbeans, rearranged it by hand, creating the MVC structure that I wanted. Now ... I ended up with alot of work ....for example ...
    Creating all the listeners for all the textfield, added a ActionListener and a Focus listener => each added 2 function calls to the controller method.
    I had to create a function for every textfield in the controller to take care of the change requests from the view.
    Create set and get methods in the model, which was pretty simple using the netbeans IDE who autogenerated the methods after I had created all the fields that I wanted.
    Implementing modelPropertyChange functionality in the view, so the fields are updated properly.
    Now, as far as I have understood this, I have to do above steps for every property/textfield that I have in a GUI?! And it will be ALOT of them, so its gonna end up with quite alot of code :P
    I admit that this is a beutiful design and once that I had gotten it down, its really neat. But ...
    My doubt is if it is neccesary to do all this for the application I am writing at the moment. All I have is a list of variables that I present in a GUI where the user can edit the values for each variable (pretty much like the property editor window in NetBeans), then when it all is done, just write the Variable name and Value to a single textfile.
    For me it seems that the modelPropertyChange callback isnt really needed at all.
    So am I heading in the wrong direction, creating a really really goodlooking app whne I maybe just need to hack some :)
    Hit me with your experince!
    And how do you edit the GUI builder and its palette. I've been in Netbeans configuration (Options->Misc.->Gui Builder), but haven't really understodd what to do there?!

  • Passing a selected file in a GUI to another class

    Hi guys. I have a GUI set up so that when a file is selected in a directory and the user presses a play button in the GUI..it plays back the sound. (Java sound used.) However i want whatever file was selected to be passed to another class also.In other words..whatever the JFileChooser selects..i want that file info to be passed to another Java class in the package...can anyone help? cheers.

    No...whatever file is selected i just want that
    instance to be sent to another class.Yes it can be done.
    These are the steps.
    1.) Choose the file you want. Once you have chosen the file retrieve the absolute path of that file.
    2.)Call a method of the other class instance to which you want to send the file passing the file path as an argument.
    3.)In the other class retrieve the String path and then use it to create a file object to access it.
    //User chooses a file from file chooser and retrieves the path of that file and stores it in a variable String file_path;
    //Now let other_class_instance be the reference of the other class to which you want to send the files path and let that other class contain a method retrievePath(String path);
    other_class_instance(file_path);
    //The method definition in the other class
    public void retrievePath(String file_path)
            File file_reference=new File(file_path);
            //Now access the file using this file_reference
    }

  • Firefox GUI sucks more with every newer version

    Firefox keeps "updating" and they change around the GUI to make it crappy and non-intuitive. I'd love to have the firefox 1.5 back, but nothing works for it. Firefox 8 is worse than ever. What the hell is wrong with these guys that they feel they need to "fix" something that already works fine. If you want to tweak your own stupid toolbars and icons, fine, but don't force your latest "innovations" on the rest of us who don't want it.

    No one is "forcing" you to use Firefox or to update beyond Firefox 3.6.x. If you don't like the user interface in the Firefox 4+ versions, stick with Firefox 3.6 until it becomes unsupported next spring; or even longer, if you are willing to accept the lack of security updates once support ends.
    Or switch to another browser. Users have more choices for web browsers now, than they ever had in the past. Of course, with that old retired operating system your choices are more limited than for WinXP users.
    BTW, it takes less than 10 minutes to re-arrange toolbar elements to make a Firefox 4+ version look almost the same as Firefox 3.6 versions. <br />
    http://www.computertechtips.net/64/make-firefox-4-look-like-ff-3-6/

Maybe you are looking for

  • How to make Kindle books open at point of last reading?

    Over the last months, when I reboot the iPad and open the Kindle app to resume reading,, it opens at a previous session, often several "reads" previously.  Any way of resolving this annoying action?  I  don't want to remove and download again as I ha

  • Debug mesages not logged in log file

    Hi, I have a situatuion where a CP invokes a stored procedure. Within it, I have a few debug messages to log scenarios. Using FND_FIL.put_line(Fnd_file.log,........... I have checked that the system Profile values at site level are as under FND: Debu

  • Anyone else getting an error message in Itunes right now?

    I keep getting an error message that has (error -50) and check back later in it. Any one else getting this?

  • Address Book opens when Mails does

    Every time I open Mail, 9 out of 10 times Address Book opens with it. This has been going on for weeks now and it really starts to irritate me. Anyone else having the same problem? I would appreciate any solution. Thanks

  • Can I see what is sent about me!

    Is there a program or setting that lets me see what is being sent from me while on the Internet? address, location and general profile like operating system type and whoknows what? I know that there may be more sent when connecting to a site. I just