Beginner question about NetBeans

I am new to java, which is why I am posting on this forum. I have been messing around with the NetBeans IDE and have made a couple GUI's now. First question is how do I have the window change. For example, if the application opened up and it showed a menu with a couple different buttons you could click to do different things, how would I make it so when you clicked a button the window changed into what was supposed to be on the screen next. Say one of the options was "Calculator", how would I make the window become a calculator after it was clicked? Do I make a new JFrame with the all the calculator stuff? If so, how do I "connect" the two of them? I want it to appear in the same window, not open a new one. My second question was how do I make it so my applications can be run from the desktop without having to build from within NetBeans?
It was a little difficult to explain what I was asking, but any help is appreciated. I am assuming that what I'm trying to do is pretty basic, sorry I'm newbie.

mdewaddict11 wrote:
I am new to java, which is why I am posting on this forum. Let me try to be the first to welcome you to our little corner of the Java world.
I have been messing around with the NetBeans IDE and have made a couple GUI's now. First question is how do I have the window change. For example, if the application opened up and it showed a menu with a couple different buttons you could click to do different things, how would I make it so when you clicked a button the window changed into what was supposed to be on the screen next. Say one of the options was "Calculator", how would I make the window become a calculator after it was clicked? Do I make a new JFrame with the all the calculator stuff? If so, how do I "connect" the two of them? I want it to appear in the same window, not open a new one. My second question was how do I make it so my applications can be run from the desktop without having to build from within NetBeans?I have a feeling that you are searching for a way to change your GUI "view" on some action, and if so, there are many solutions to do this. Probably one of the more common ways is to use a CardLayout to swap JPanels, but other options including popping up a JDialog, using JTabbedPanes, hiding a JFrame and showing another, ... exist.
It was a little difficult to explain what I was asking, but any help is appreciated. I am assuming that what I'm trying to do is pretty basic, sorry I'm newbie.You're doing fine, relax.
Now I need to get on my soap box and discuss another issue that you've not asked about. First off, Java is not like Visual Basic, C#, or other .NET languages (assuming you may be familiar with the MS Visual Studio) in that our programs are not first and foremost GUI's with code tacked on. There's a lot to learn when starting to code in Java, enough that adding Java GUI coding may be a bit overwhelming at the start. I'm going to recommend that you put the GUI stuff to the side for a bit, study the basics of Java, and then later when you're comfortable with the rudiments of Java, start learning Swing coding but without NetBeans code generation. If you learn it through the Sun tutorials, Swing will make a whole lot more sense and even using NetBeans to generate some Swing code will be easier for you. Regardless what you do, best of luck!
Edited by: Encephalopathic on Jul 7, 2010 2:15 PM

Similar Messages

  • Where is the best place to ask questions about NetBeans 6 for Java?

    When it comes to Java discussions, all I can think is this forum, but what about Java Desktop Applications using NetBeans IDE 6?
    Question/Query 1:
    I just like to ask how I can make the Database Application Template under the Java> Java Desktop Application> Database Application:
    Well, the the nice Frame with prebuilt components are good, but how can we customize the Window Icon? Has anybody in this forum and particularly Netbeans 6 users encountered the same scenario?
    Question/Query 2:
    How can I make a splash page with such a Database Application template too?

    Hello Andy,
    we talk about Photoshop, or? In this case you should use Photoshop General Discussion
    You will find all the (other) communities by clicking "Adobe Communities" on the top of the window. Please have a look at
    https://forums.adobe.com/welcome (see screenshot) and/or open "All communities"
    Hans-Günter

  • Question about netbeans platform

    I've been sifting through tutorials and the like for a few hours now and I still can't get a straight answer. I'm developing a module suit which uses the netbeans platform (my first Java endeavor). I'm working in Netbeans 5.0. I've made all my classes and forms and stuff. My question is this: how the heck to I get a form/panel to load when the application starts up? When I run the application I only get the platform without my panels and forms. What's the cleanest way to do this?

    Hehe, thanks for the advice. Yeah I wasn't saying
    that this should or shouldn't be a forum based on
    netbeans or Eclipse. It's actually a little
    refreshing to find a forum that is devoted to the
    language instead of the IDE. at the moment, it's pretty much devoted to doing peoples homework for them and generally wiping their @rses for them, hence the frosty reception you got above! don't take it to heart!
    Not really sure why my company wanted NetBeans and
    not Eclipse, but oh well.probably an assumption that since Sun wrote it, it must work better with Java. or they've heard some of the horror stories about how buggy Eclipse is. I haven't used Netbeans so I can't really comment, but buggy though Eclipse is, I still like it, both as an IDE and a platform

  • Beginner question about CommandListener

    Hi all! I am programming my first cell phone application. Here´s my problem: I have a sequence of menus and all of them use CommandListener to figure out what should be done next. I will put part of my code
    public class Planilha extends MIDlet implements CommandListener {
    private List mList, mListSec, mListMes;
    Form formPerfil,formPagto,fromVis;
    //Here I have declared Commands, etc
    /Construtor
    public Planilha(){
              //THIS IS MY MAIN PANEL. FROM HERE, I HAVE 3 PATHS(3 ANOTHER PANELS)
              mList = new List("Expenses", List.IMPLICIT, stringElements, imageElements);//stringElements and imageElements are initialized
            //Commands are initialized
            mList.addCommand(cFirst);
            mList.addCommand(cSec);
            mList.addCommand(cThird);
           mList.setCommandListener(this);
           //THIS IS ONE OPTION THAT CAN BE ACTIVATED AFTER PANEL mList
           formPerfil = new Form("Budget");
            //Commands are initilized
                formPerfil.addCommand(cBack);
         formPerfil.addCommand(cSave);
         formPerfil.setCommandListener(this);
           //THIS IS A SECOND OPTION THAT CAN BE ACTIVATED AFTER PANEL mList
           mListSec = new List("Expenses", List.IMPLICIT, stringElements1, imageElements1);
           mListSec.addCommand(cBack);
           mListSec.addCommand(cExpense);
           mListSec.setCommandListener(this);
           //STILL GOT A THIRD OPTION BUT I WILL LEFT IT OUT
    public void startApp() {
        Display.getDisplay(this).setCurrent(mList);
    //HERE IS MY PROBLEM. ONLY FIRST OPTION IS BEING REACHED
    public void commandAction(Command c, Displayable s) {
        if (c == cFirst || c == List.SELECT_COMMAND) {
          //HERE I CALL THE FIRST POSSIBLE PATH
             Display.getDisplay(this).setCurrent(formPerfil);
        else if(c == cSec){
             //HERE I CALL THE SECOND OPTION
             Display.getDisplay(this).setCurrent(mListSec);
        else if(c == cThird){
             //A THIRD OPTION FROM PANEL mList
            Display.getDisplay(this).setCurrent(mListMes);
        else if(c == cExpense){
        //HERE A COMMAND COMMING FROM THE SECOND PANEL. ITS NEVER CALLED
         //ANOTHER COMMAND THAT DOES NOT COME FROM MAIN PANEL (mList)
        //IS THIS CORRECT TO PUT THIS COMMAND IN THE SAME COMMAND LISTENER?
        else if(c == cSave){ }So my problem is: even if I choose option 2 or 3 from mList, only the first option is selected. In other words, only formPerfil is being called.
    My second question is that I have some command listeners on the other panels but mList. Is this correct to add in the same method CommandAction? For example, I added "cSave" and "cExpense". Is there any problem with it?
    Thx in advance

    ThomYork wrote:
    ...So my problem is: even if I choose option 2 or 3 from mList, only the first option is selected. In other words, only formPerfil is being called.
    My second question is that I have some command listeners on the other panels but mList. Is this correct to add in the same method CommandAction? For example, I added "cSave" and "cExpense". Is there any problem with it?I can't point exactly but the way how you "mix" select command with cFirst, cSec and cThird just doesn't feel right.
    To handle selection in implicit list, neither of added commands is necessary. It is sufficient to just detect select command in the list and then use [getSelectedIndex() method|http://java.sun.com/javame/reference/apis/jsr118/javax/microedition/lcdui/List.html#getSelectedIndex()|javadoc] to figure which item was selected.
    Another thing that looks suspicious is that commandAction does not check the displayable parameter ('s'). Say, without checking this paramenter, one will never know if SELECT_COMMAND comes from mList or mListSec.
    Regarding your questions on handling "cSave" and "cExpense" commands in mList's comandAction, the way you do it is legal.
    By the way, it is equally legal to do it the other way - ie provide dedicated listener for formPerfil and handle its commands in that dedicated listener. It is a matter of your personal preference, which way to choose. Myself, I more often use dedicated listeners, about like like this:
    // assuming that list is implicit and that no commands are added
    //   to mList, ie only select command is available by default...
    mList.setCommandListener (new CommandListener() {
      public void commandAction(Command c, Displayable s) {
        // here,
        //  - I don't check c since I expect only SELECT_COMMAND
        //  - I don't check s since I expect only mList
        switch (mList.getSelectedIndex()) {
          // do things depending on list selection
    });

  • Beginner question about installing 1.5 on new machine

    I signed up for a Creative Cloud account when Edge Animate 1.0 was released and installed it on my laptop.  I am finally going to set aside some time to learn the software, but I have a better, new laptop now.
    It was my understanding at the time, and I have read about this recently too, that Adobe was being gracious enough to offer versions 1.0 and 1.5 indefinitely for free.
    My problem is that on my new laptop I can't install the software.  I found links for the Adobe Application Manager and people saying you could get it through there.  But when I open AAM there is no option to download the software.  I also installed the Creative Cloud software, but can't download 1.5 from there either, only the 30 day trial version (not what I was looking for).
    I was hoping to get the one that will work indefinitely at version 1.5 like I had previously, on my new computer (except I actually have 1.0 on my old computer).
    Any tips?
    I apologize if this has already been covered, I searched extensively through the forums to see if there was already an answer to my question.

    Hi, Jason-
    I want to clarify that we are not offering 1.0 and 1.5 indefinitely for free; we are offering 1.x in a perpetual license for a promotional price of free.  The first statement implies that we will always offer 1.5, no matter what happens with the HTML world.  The latter means that once you download 1.x, we won't expire the version you download.  Just wanted to clarify your statement.
    Thanks,
    -Elaine

  • Another beginner question about targeting functions

    I've read what I thought was an excellent thread about scope in EA, but I'm still not getting some of the basics (btw the thread was http://forums.adobe.com/message/5287753#5287753).
    I have "slides" in the symbol library and in the main composition compositionReady script I've set up a generic script for playing back sound. That script works fine when I bind it within the compositionReady script to a symbol and click, so I know the funciton itself is fine. My question, I'm programmatically loading the slides from the library as I go along and want to use the generic function I created in the compositionReady script, but I can't seem to create the proper syntax to call the script. Here's some that I have tried. What is the correct syntax? The script is on frame inside the slide symbol.
    //sym.getComposition().getStage().playSound();
    //sym.getComposition().playSound();
    //Edge.getComposition("CER_1").playSound();

    Thanks for having a look. Yea, it's getting to the script fine but it doesn't like the syntax. Console always indicates javascript error, which is what happens when Edge throws an exception because it doesn't know what to do. The article that Elaine posted on above gives me the sense that it might be best to change the function to a variable, then it would be in scope to call but I have parameters I'd like to pass with it and I don't think  I can pass a parameter with to a variabalized (word?) function. I know it's just me moving from ActionScript to Edge JavaScript and scope. Whereas I could always find a homebase in ActionScript with the stage, it seems that the stage in Edge is just another symbol and calling a function within the stage is never getting there. Elaine hints at putting outside the stage closure and it would be accessible, which, of course, has led me to start readying JavaScript books and learning more about scope etc. It seems like that is life as a developer. I  dont' get that, oh, better take a day or two to  understand that concept, oh, that function works now, next problem. ;-)

  • Beginner question about granting access rights

    Hi, am a total beginner, just a very simple question. I have created a number of tables with my admin account that I would like user accounts to be able to see (they should only be allowed to see these few tables)
    I then created a user account called EDWARD with just the basic connect access right (I don't want them to be able to create/delete tables etc, just to be able to query the tables I have created above and to add rows to these tables)
    Google searching has lead me to the grant statement, so I tried this from the admin account:
    grant select, update, insert on CUSTOMERS to EDWARD;
    This statement executes correctly but when I log in the EDWARD account I cannot do any of these things, instead I get the error: ORA-00942: table or view does not exist
    Any ideas?
    Thanks

    >>Would it be better to create a separate account called 'ADMIN' perhaps that I use for
    my application admin and then grant them appropriate access to confidential tables
    rather than logging them in as the SYSTEM?
    Yes, this is what I would advise, since SYSTEM (like SYS and several others...) is not user like other, it's better do not work and create object under this one. Keep it for Oracle administration usage only, not for application administration, create your own schema for this.
    Nicolas.

  • Beginner question about prepared statements...PLEASE help! :-)

    First let me say thanks for the assistance. This is probably really easy to do, but I'm new to JSP and can't seem to figure it out.
    I want to dynamically populate a table that shows whether a particular person has an appointment at a given date and time with a user. To do this, I want to query the MySQL database for the lastname of the person with the appointment that occurs with the user at the year, month, date, and time, in question.
    THE CODE BELOW DOESN'T WORK (obviously) BUT SOMEWHAT ILLUSTRATES WHAT I'M TRYING TO ACCOMPLISH:
    <%
    Driver DriverTestRecordSet = (Driver)Class.forName(MM_website_DRIVER).newInstance();
    Connection ConnTestRecordSet = DriverManager.getConnection(MM_website_STRING,MM_website_USERNAME,MM_website_PASSWORD);
    PreparedStatement StatementTestRecordSet = ConnTestRecordSet.prepareStatement("SELECT lastname FROM appts_pid1 WHERE user_id='<%=(((Recordset1_data = Recordset1.getObject(user_id))==null || Recordset1.wasNull())?"":Recordset1_data)%>' AND year='<%= yy %>' AND month='<%= months[mm] %>' AND date='<%= dates[dd] %>' AND appttime='16:15:00'");
    ResultSet TestRecordSet = StatementTestRecordSet.executeQuery();
    boolean TestRecordSet_isEmpty = !TestRecordSet.next();
    boolean TestRecordSet_hasData = !TestRecordSet_isEmpty;
    Object TestRecordSet_data;
    int TestRecordSet_numRows = 0;
    %>
    The real problem comes in the prepared statement portion. If I build the prepared statement with static values like below, EVERYTHING WORKS GREAT:
    PreparedStatement StatementTestRecordSet = ConnTestRecordSet.prepareStatement("SELECT lastname FROM appts_pid1 WHERE user_id='1' AND year='2002' AND month='October' AND date='31' AND appttime='16:15:00'");
    But when I try to use dynamic values, everything falls apart. It's not that the values aren't defined, I use the user_id, year <%= yy %>, month <%= months[mm] %>, etc. elsewhere on the page with no problems. It's just that I can't figure out how to use these dynamic values within the prepared statement.
    Thanks for reading this far and thanks in advance for the help!!!!

    Hi PhineasGage
    You are little bit wrong in your
    your preparedStatement.
    Expression tag within scriptlet tag is invalid.
    Whenever you are appending the statement with
    expression tag, append it with "+" and remove
    expression tag.
    Hopefully it will work
    ThanksThanks for the response!
    I know that the expression tag within scriptlet tag is invalid. I just need a workaround for what I want to do.
    I'm unclear what you mean by "Whenever you are appending the statement with expression tag, append it with a "+" and remove expression tag".
    Could you give an example?
    In the meantime, I've been trying to digest the docs on prepared statements and have changed the code to look like:
    PreparedStatement StatementTestRecordSet = ConnTestRecordSet.prepareStatement("SELECT lastname FROM appts_pid1 WHERE user_id= ? AND year= ? AND month= ? AND date= ? AND appttime='13:15:00'");
    StatementTestRecordSet.setInt(1,1);
    StatementTestRecordSet.setInt(2,2002);
    StatementTestRecordSet.setString(3,"October");
    StatementTestRecordSet.setInt(4,31);
    Again, WITH THE STATIC VALUES, THIS WORKS FINE...but when I try to use expressions or variables like below, things don't work:
    StatementTestRecordSet.setInt(2,<%= yy %>);
    Obviously, I'm doing something wrong, but there has to be a way to use variables within the prepared statement.
    ALSO, the values are being passed to this page via URL in the form:
    samplepage?user_id=1&year=2002&month=October&date=31
    Based upon this information, is there another way (outside of stored procedures in the db) to do what I want to do? I'm open to ideas.

  • Beginner Question about Substitution in 0kem

    Good morning everyone,
    I'm new to ABAP and have been assigned a project with using a substitution for the Profit Center. I've been looking around and can't seem to find an answer to a basic question - does a substitution only work if a sales order is created in VA01 or does it also activate when a sales order is modified? I can't seem to activate the substitution rule even though I have gone through all the correct steps to create one. I'm wondering if it's because the test data only has me modify a previously created profit center when I need to create a new one? Sorry if this question has been asked before but I couldn't find it with all my googling.

    Hi,
    It only works at the time of sale order creation.
    Regards,
    Mukthar

  • Quick beginner question about Applications folder

    I have a really simple basic question: Can I organize my computer's applications folder anyway I want? I don't want to move anything out of the apps folder but I do want to group my apps by a few different categories using folders. I don't see why this would be a problem but I wanted to be sure before I fouled anything up. (Time Machine will be nice).

    Create an Applications folder in your home folder and fill it with aliases to the real applications. You can organise these into sub-folders as you wish, without affecting the real applications. Moving the real applications can make updates fail. Different users can have different arrangements of applications.

  • Beginner question about using selection tools (Mac OS X 10.6 user)

    I click on, say, Magnetic Lasso and it does its thing. But, in true Sorcerer's Apprentice fashion, it keeps on going and going. Two questions: how to stop the tool, and how to correct the deviant strokes? To stop ML, I click Command + D and nothing happens. I choose Deselect and nothing happens. Also, I am trying to select 2 discontinuous regions in the photo. How to do that? Thanks!

    When you double click, it should finish up the selection. You can use the selection brush to tidy up (Option-drag to remove areas.)
    To add more areas hold down shift as you select or turn on the add to selection square in the options bar if the tool has it.

  • Simple beginner question about default tables (LOGMNR, etc.)

    Hi all, I just installed SQL Developer and the Express server. I have worked with other SQL databases and with remote Oracle databases. But never been a DBA for an Oracle DB. I tried searching on LOGMNR and AQ$_, but couldn't find anything, hence this question.
    If there is some online documentation that covers these particular tables and my question, then a pointer to that would be appreciated.
    Anyway, I created a connection per the instructions and it seemed to work. But when I look at tables listview, I see a whole slew of tables. I assume these are all housekeeping/meta data tables (eg. information_schema in MySQL). Is this correct?
    Also, short of manually creating a filter for each of the file types ("%$%"help", "LOGMNR%", "SQLPLUS%", etc.), is there an easy way to ignore these tables and just see the tables I want to create for testing purposes?
    And I am curios why these all show up by default. Could it be that I am expecting something because of experience with other databases and am actually doing things the "wrong" way? Or is this just because I am using the Express Server? Or is there another (very good) reason for these tables to exist?
    Thanks,
    justme

    The complete oracle documentation is at http://tahiti.oracle.com. There is a lot of it, but Log Miner and Advanced Queuing have their own manuals. You should also consider starting with the Concepts Manual followed by one of the "2-day" tutorials such as "2-Day DBA"
    What user are you connecting as? It sounds as if you are connecting as SYS or SYSTEM if you can see the dictionary tables.
    You should create a separate user to connect as.
    (create user myuser identified by mypassword;
    grant connect,resource to myuser;)

  • Beginner question about the size of the documents and fonts

    I have worked with dps a couple of years now and now that Adobe removes Single Edition I have to look at other tools. EPUB3 fixed layout appears to be an alternative solution.
    I've been reading up on the web and checked on Lynda courses, but there is one thing I wonder about.
    How should I think about the size of the InDesign document and the size of the body text when I create a EPUB3 with fixed-layout?
    Regards
    Ake

    A couple things to keep in mind with EPUB3 Fixed Layout:
    Unlike EPUB reflowable, FXL doesn't change size. You'll need to optimize your InDesign layout for the device most likely to view it—for example, an iPad, since it's the dominant device.
    Like with DPS, you'll need to pick a font size larger than you'd use for print.
    As with DPS, it's very important to do some tests on your target device to optimize both dimensions and font size.
    Final Note: If you're in North America, this is a good time to  buy an iPad since there are a lot of Black Friday sales coming up!

  • Beginner question about flickering

    Ok, I'm new to ActionScript, but I can adapt quite easily, so I have started a project, it loads a XML file with some data, after it is loaded it adds a bar for every node it can find in the xml file. The bar is converted to a symbol and acts as a button. Now I want to add a label as a child to the bar. And there comes the problem, when I add the label to the bar, and compile the .fla the label is flickering all the time. I also pull some data from each node to add a text to the label, but its not beeing displayed either. Could someone please explain me, why the label is flickering and the bar is not?
    Here is the code so far for adding the bars and the labels
    var btn:Standing; // Symbol
                                  var lbl:XmlLabel;
                                  for (var i:int = 0; i < len; i++) {
                                            btn = new Standing();
                                            btn.x = 287;
                                            btn.y = 190 + i * 46;
                                            addChild(btn);
                                            btn.name = "btn" + i;
                                            btn.buttonMode = true;
                                            btn.addEventListener(MouseEvent.CLICK, onButtonClick);
                                            var teamElement:XML = teamElements[i];
                                            var nameString:String = teamElement.@name;
                                            var winString:String = teamElement.@wins;
                                            var lossesString:String = teamElement.@losses;
                                            var id:int = parseInt(nameString);
                                            for (var o:int = 0; o < 4; o++) {
                                                      lbl = new XmlLabel();
                                                      lbl.x = 20 + o * 70;
                                                      lbl.y = 10;
                                                      lbl.text = nameString.toString();
                                                      btn.addChild(lbl);
                                                      lbl.name = "lbl" + i + o;
    Thanks for the help

    XmlLabel is a MovieClip, I have dragged it from the components panel to my stage and deleted it and edited its properties in the library panel
    EDIT: I have marked your answer as correct, because you hinted me to the correct solution, I had to make the Label's base class fl.controls.Label and not the standard
    flash.display.MovieClip
    Thanks for the hint

  • Beginner question about Mic use

    I have a mic that I use to use with an older PC and when I plug it in to my MBP it doesn't work. Should any mic work with the mac or do ya need a mac specific mic. Any help or suggestions is greatly appreciated. Thanks

    Depending on what you are recording and quality needed, there is a built in microphone in your computer.
    Also. http://docs.info.apple.com/article.html?artnum=303490
    Connect your MacBook Pro to a line-level microphone or optical digital audio equipment. The Audio In port accommodates both optical digital audio input and analog audio input.
    Analog audio line input is accepted through a 3.5mm mini phone jack which does not provide power to a connected device, so you must use self-powered peripherals. The sound input jack accepts line-level stereo signals up to 24-bit stereo 44.1-192kHz sampling rate. It also accepts a stereo miniplug-to-RCA cable adapter for connecting stereo equipment to the computer.
    Optical audio input is SPDIF format and uses a standard toslink cable with a toslink mini-plug adapter, accepting up to 24-bit stereo and 44.1-96kHz sampling rate.

Maybe you are looking for

  • How can i restore my ipod 4 8g after accidentally reset all the files?

    How can i restore the Apllications for my ipod touch 4 8g? I accidentally reset all files and documents and cannot open again. Once i turned on the unit it only displays the apple logo. please help me.

  • Places Lookup Table in iphoto

    why is my places lookup disabled in iphoto

  • Stupidly Bad OS Problem With MBP

    I know, it was an incredibly stupid thing to do but I moved a file called 'SKPlugins' out of the core services folder and put it in the trash!! now the dock doesn't load, the side bar doesn't load and worst of all.. drop and drag doesn't load so I ca

  • Set up email key on E61 for several mailboxes

    Hi, is there any way I can configure the email key on my E61 to connect to more than one mailbox and download new emails? I have three which are more or less equally likely to have important new mails at any time. Thank you very much! Regards, Hendik

  • Documents and Cloud Business App

    based on this  http://blogs.msdn.com/b/officeapps/archive/2014/03/18/integrating-documents-into-cloud-business-apps.aspx Are you limited to files less than 1.5MB ? is there a way to get this working using REST so we can upload bigger files? thanks Mr