Swing package

I just downloaded JDK1.1.8. I tried using some methods from the swing package, so I can display output in a simple GUI.
When I compiled the program, I got the following error:
Welcome2.java:3: Package javax.swing not found in
import.
import javax.swing.*;
^
1 error
I'm not having this problem with other packages I try to import. Does anyone know why the compiler won't let me import the swing package?
Thanks,
RM

I'm sorry, but that did not work. Swing doesn't come with 1.1.8.
Did you download another component that claimed to be swing and install it? Did you adjust your classpath to include it? Until you do that then nothing you do in your java program will allow you to use it.

Similar Messages

  • Regarding swing package

    hi Java Friends
    iam Easu Babu.
    how to write Actions for buttons using SWING package
    regards.,
    Easu

    [http://java.sun.com/docs/books/tutorial/uiswing/components/button.html]

  • Missing classes from the javax.swing package?

    Can anyone throw any light on what appears to be a missing class from the javax.swing package?
    When CelsiusConverter.java from The Swing Tutorial (code fragment shown below) is compiled the JFrame class can't be found.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class CelsiusConverter implements ActionListener {
        JFrame converterFrame;Despite the package javax.swing being imported, the compiler does not seem to be be able to find the JFrame class.
    CelsiusConverter.java:14: Class JFrame not found in type declaration.
        JFrame converterFrame;To attempt to solve this issue all the files in jdk1.5.0_02\lib were added to CLASSPATH.
    CLASSPATH was set to C:\Program Files\Java\jdk1.5.0_02\lib\dt.jar;C:\Program Files\Java\jdk1.5.0_02\lib\htmlconverter.jar;C:\Program Files\Java\jdk1.5.0_02\lib\jconsole.jar;C:\Program Files\Java\jdk1.5.0_02\lib\tools.jar;C:\Program Files\Java\jdk1.5.0_02\lib;C:\Program Files\Java\jdk1.5.0_02\lib\ir.idl;C:\Program Files\Java\jdk1.5.0_02\lib\jawt.lib;C:\Program Files\Java\jdk1.5.0_02\lib\jvm.lib;C:\Program Files\Java\jdk1.5.0_02\lib\orb.idl;C:\Program Files\Java\jdk1.5.0_02\demo\jfc\SwingApplet\SwingApplet.jar;.;c:\CoreJavaBook

    This is extremely strange... If you're sure it's not a problem in your code or with your classpath, the only other thing I can think to suggest is re-downloading / installing java

  • Is the Swing Package in Java obsolete?

    hey guys,
    i'm just a newbie java enthusiast here and all the while i've been learning to manipulate data in minimal ways using the Swing package especially the JOptionPane class.
    is this class/package already obsolete? a person here in school told me so? well?

    Your friend probably confused it with AWT, -which was used for doing gui stuff back in the dark ages before Swing came along.
    Nowdays people use Swing instead of AWT for doing gui stuff in Java, so awt could in some ways be considered obsolete (except of course that Swing uses quite a bit of awt stuff behind the scenes!)
    If you dont use Swing what will you use for gui?

  • 1.Swing package in J2ME ? 2. Profile choice ?

    Is Swing package integrated in J2ME ?
    I actually search for tools in order to develop a java application for Sharp Zaurus.
    I heared talk about AWT which is completely integrated in Personal Profile but concerning Swing I don't know.
    What is the best choice between Personal Profile or PersonalJava to develop on such a device ?
    Thank You
    --::(Excuse my english...)::--

    Swiming is too heavy for J2ME, that's why so limited support for graphic/UI in J2ME/MIDP. However, you may have a look at LWT from Motorola which is a extension for MIDP to add more UI element such as check box etc. But I am not sure if it could be deployed in other non-MOto mobile like Nokia.
    use the lightweight AWT for PersonalJava environment if you have to finish something urgent. Though PersonalJava will be merged into PP in J2ME in the future, but it's much more mature than PP at this time. As well as too few mobileset support PP.
    Jeode(Insignia's implementation of PersonalJava) is the official partner for PPC device as initial installed on HP/Compaq iPAQ, Dell Axim as well as preinstalled on Zaurus from Sharp.
    best choice, at this time to me

  • Download swing package and plugin?

    Hi everybody!
    I have a question. Is there anyone who knows a nice place for downloading the javax.swing package only? Or maybe a place for finding nice swing plugins?
    Best regards and Thanks!
    jenny

    If you use Java 2 or higher, you do not need download Swing separately, because it's already included in Java 2.

  • Swing - packaging configuration files

    Hi All,
    I need some advice in packaging swing applications,
    our requirement is such that some params keep changing frequently(not only at deploy time) hence all this params in config file.
    Iam using Netbeans to build the swing app, however Netbeans automatically package the config files under the /classes directory and builds the .jar file when built.
    is there some way we can place the config files outside the .jar file??
    coz, it is cumbersome to change params each time need to unpack jar file and repack it.
    I would greatly appreciate any help.
    thanks a lot

    So my solution is not what you want -
    http://forum.java.sun.com/thread.jspa?threadID=769146&messageID=4383774#4383774

  • Com.sun.java.swing package not found

    All my other programs compile fine if they're not using that package

    yea...wrong import....
    use
    import javax.swing.*;notice the X

  • Query on swing packages

    Hi,
    Please tell me the differences between
    import sun.awt.image.*;
    import java.awt.image.*;
    import com.sun.image.*;
    Thanks.

    I can explain the second part of your question "differance between lightweight and heavyweight". Lightweight components are components that have no dependance on native GUI elements from the underlying Operating System, they are drawn directly by pure java drawing routines. On the other hand heavyweight components are dependant on an OS native "peer" object for some functionality. This makes heavyweight objects have a higher memory footprint.

  • Package com.sun.java.swing not found in import

    I'm trying to show graphic information but the swing package does not load up don't know what is going on Any help is welcome
    THIS IS THE LINE I GET WHEN I TRY TO IMPORT SWING
    Package com.sun.java.swing not found in import

    I'm trying to show graphic information but the swing
    package does not load up don't know what is going on
    Any help is welcome
    THIS IS THE LINE I GET WHEN I TRY TO IMPORT SWING
    Package com.sun.java.swing not found in importThat's an old package reference. Try javax.swing

  • Swing application in JRE 1.5 Vs JRE 1.6

    hi,
    i have developed my application in java swing and JRE 1.5. Its working fine.
    But, when i am executing it using JRE 1.6, then some control, i.e. Jbutton is not visible. When i am moving mouse over that control then it is visible.
    Another problem i am facing is that, Tabbed pane is not showing properly in JRE 1.6. when i am clicking on any tab, then tab pane is appearing properly.
    so, what is the problem ?
    how to resolve it.?
    please help me, its urgent.
    Thank You.

    Hi,
    I think there are some changes in 1.6 vs 1.5 swing packages. I made a gui app in net beans using 1.6 and I cannot compile it in 1.5. I think 1.6 introduced new classes & what not.
    In other words, i'm not surprised there are some issues, I would either redo it in 1.6 or stick with 1.5

  • How do I make a batch file if the .class file uses a foreign package?

    I am trying to make an MS-DOS batch file using the bytecode file from the Java source file, called AddFields.java. This program uses the package BreezySwing; which is not standard with the JDK. I had to download it seperately. I will come back to this batch file later.
    But first, in order to prove the concept, I created a Java file called Soap.java in JCreator. It is a very simple GUI program that uses the javax.swing package; which does come with the JDK. The JDK is currently stored in the following directory: C:\Program Files\Java\jdk1.6.0_07. I have the PATH environment variable set to the 'bin' folder of the JDK. I believe that it is important that this variable stay this way because C:\Program Files\Java\jdk1.6.0_07\bin is where the file 'java.exe' and 'javac.exe' are stored. Here is my batch file so far for Soap:
    @echo off
    cd \acorn
    set path=C:\Program Files\Java\jdk1.6.0_07\bin
    set classpath=.
    java Soap
    pause
    Before I ran this file, I compiled Soap.java in my IDE and then ran it successfully. Then I moved the .class file to the directory C:\acorn. I put NOTHING ELSE in this folder. then I told the computer where to find the file 'java.exe' which I know is needed for execution of the .class file. I put the above text in Notepad and then saved it as Soap.bat onto my desktop. When I double click on it, the command prompt comes up in a little green box for a few seconds, and then the GUI opens and says "It Works!". Now that I know the concept of batch files, I tried creating another one that used the BreezySwing package.
    After I installed my JDK, I installed BreezySwing and TerminalIO which are two foreign packages that make building code much easier. I downloaded the .zip file from Lambert and Osborne called BreezySwingAndTerminalIO.zip. I extracted the files to the 'bin' folder of my JDK. Once I did this, and set the PATH environment variable to the 'bin' folder of my JDK, all BreezySwing and TerminalIO programs that I made worked. Now I wanted to make a batch file from the program AddFields.java. It is a GUI program that imports two packages, the traditional GUI javax.swing package and the foreign package BreezySwing. The user enters two numbers in two DoubleField objects and then selects one of four buttons; one for each arithmetic operation (add, subtract, multiply, or divide). Then the program displays the solution in a third DoubleField object. This program both compiles and runs successfully in JCreator. So, next I moved the .class file from the MyProjects folder that JCreator uses to C:\acorn. I put nothing else in this folder. The file Soap.class was still in there, but I did not think it would matter. Then I created the batch file:
    @echo off
    cd \acorn
    set path=C:\Program Files\Java\jdk1.6.0_07\bin
    set classpath=.
    java AddFields
    pause
    As you can see, it is exactly the same as the one for Soap. I made this file in Notepad and called it AddFields.bat. Upon double clicking on the file, I got this error message from command prompt:
    Exception in thread "main" java.lang.NoClassDefFoundError: BreezySwing/GBFrame
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
    4)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    Caused by: java.lang.ClassNotFoundException: BreezySwing.GBFrame
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    ... 12 more
    Press any key to continue . . .
    I know that most of this makes no sense; but that it only means that it cannot find the class BreezySwing or GBFrame (which AddFields extends). Notice, however that it does not give an error for javax.swing. If I change the "set path..." command to anything other than the 'bin' folder of my JDK, I get this error:
    'java' is not recognized as an internal or external command,
    operable program or batch file.
    Press any key to continue . . .
    I know this means that the computer cannot find the file 'java.exe' which I believe holds all of the java.x.y.z style packages (native packages); but not BreezySwing or any other foreign packages. Remember, I do not get this error for any of the native Java packages. I decided to compare the java.x.y.z packages with BreezySwing:
    I see that all of the native packages are not actually visible in the JDK's bin folder. I think that they are all stored in one of the .exe files in there because there are no .class files in the JDK's bin folder.
    However, BreezySwing is different, there is no such file called "BreezySwing.exe"; there are just about 20 .class files all with names like "GBFrame.class", and "GBActionListener.class". As a last effort, I moved all of these .class files directly into the bin folder (they were originally in a seperate folder called BreezySwingAndTerminalIO). This did nothing; even with all of the files in the same folder as java.exe.
    So my question is: What do I need to do to get the BreezySwing package recognized on my computer? Is there possibly a download for a file called "BreezySwing.exe" somewhere that would be similar to "java.exe" and contain all of the BreezySwing packages?

    There is a lot of detail in your posts. I won't properly quote everything you put (too laborious). Instead I'll just put your words inside quotes (").
    "..there are some things about the interface that I do not like."
    Like +what?+ This is not a help desk, and I would appreciate you participating in this discussion by providing details of what it is about the 'interface' of webstart that you 'do not like'. They are probably misunderstandings on your part.
    "Some of the .jar files I made were so dangerously corrupt, that I had to restart my computer before I could delete them."
    Corrupt?! I have never once had the Java tools produce a corrupt Jar. OTOH, the 'cannot delete' problem might relate to the JRE gaining a file lock on the archive at run-time. If the file lock persisted after ending the app., it suggests that the JRE was not properly shut down. This is a bug in the code and should be fixed. Deploying as .class files will only 'hide' the problem (from casual inspection - though the Task Manager should show the orphaned 'java' process).
    "I then turned to batch files for their simple structure and portability (I managed to successfully transport a java.util containing batch file from my computer to another). This was what I did:
    - I created a folder called Task
    - Then I copied three things into this folder: 1. The file "java.exe" from my JDK. 2. The program's .class file (Count.class). and 3. The original batch file.
    - Then I moved the folder from a removable disk to the second computer's C drive (C:\Task).
    - Last, I changed the code in the batch file...:"
    That is the +funniest+ thing I've heard on the forums in the last 72 hours. You say that is easy?! Some points.
    - editing batch files is not scalable to 100+ machines, let alone 10000+.
    - The fact that Java worked on the target machine was because it was +already installed.+ Dragging the 'java.exe' onto a Windows PC which has no Java will not magically make it 'Java enabled'.
    And speaking of Java on the client machine. Webstart has in-built mechanisms to ensure that the end user has the minimum required Java version to run the app. - we can also use the [deployJava.js|http://java.sun.com/javase/6/docs/technotes/guides/jweb/deployment_advice.html#deplToolkit] on the original web page, to check for minimum Java before it puts the link to download/install the app. - if the user does not have the required Java, the script should guide them through installing it.
    Those nice features in deployJava.js are available to applets and apps. launched using webstart, but they are not available for (plain) Jar's or loose class files. So if 'ensuring the user has Java' is one of the requirements for your launch, you are barking up the wrong tree by deploying loose class files.
    Note also that if you abandon webstart, but have your app. set up to work from a Jar, the installation process would be similar to above (though it would not need a .bat file, or editing it). This basic strategy is one way that I provide [Appleteer (as a downloadable ZIP archive)|http://pscode.org/appleteer/#download]. Though I side-step your part 1 by putting the stuff into a Jar with the path Appleteer/ - when the user expands the ZIP, the parts of the app. are already in the Appleteer directory.
    Appleteer is also provided as a webstart launched application (and as an applet). Either of those are 'easier' to use than the downloadable ZIP, but I thought I would provide it in case the end user wants to save it to disk and transport the app. to a machine with no internet connection, but with Java (why they would be testing applets on a PC with no internet connection, I am not sure - but the option is there).
    "I know that .jar and .exe files are out because I always get errors and I do not like their interfaces. "
    What on earth are you talking about? Once the app. is on-screen, the end user would not be able to distinguish between
    1) A Jar launched using a manifest.
    2) A Jar launched using webstart.
    3) Loose class files.
    Your fixation on .bat files sounds much like the adage that 'If the only tool you have is a hammer, every job starts to look like a nail'.
    Get over them, will you? +Using .bat files is not a practical way to provide a Java app. to the end user+ (and launching an app. from a .bat looks quite crappy and 'second hand' to +this+ user).
    Edit 1:
    The instructions for running Appleteer as a Jar are further up the page, in the [Running Appleteer: Application|http://pscode.org/appleteer/#application] section.
    Edited by: AndrewThompson64 on May 19, 2009 12:06 PM

  • One statement is not working in swing

    T2.setEchoChar('*');
    Can above statement use in swing package?
    Else What is the statement can use to encypt the data in the text field allocated for the password like above statement?

    Maybe this will answer your question.

  • Importing Packages in Sun Java Studio Enterprise 8

    Just started using SJSE8.
    I'm designing a new project, and would like to display the packages that I need to import in my diagrams (class, etc.)
    e.g. I've got an attribute in my diagram that I need to be declared as a JTree, how do I show that the javax.swing.* package has to be imported?

    You have two chooses. If you have not already created the attribute ,you can specify the attribute type by using the fully qualified name of the datatype. Example
    public javax::swing::JTree myOp()Note that I have used the UML scope operator, not the Java scoped operator.
    If you have already created the attribute, a JTree datatype will be present in the root of the model tree. You can create a javax package, then create a swing package inside of the javax package. After the packages are created you can drag the JTree datatype and drop it into the swing package. Your source code should be updated correctly.

  • Is swing does not work in jdk1.4?

    Sirs,
    I've tried to compile the following code,
    import javax.swing.*;
    public class HelloWorldSwing {
    * Create the GUI and show it. For thread safety,
    * this method should be invoked from the
    * event-dispatching thread.
    private static void createAndShowGUI() {
    //Make sure we have nice window decorations.
    JFrame.setDefaultLookAndFeelDecorated(true);
    //Create and set up the window.
    JFrame frame = new JFrame("HelloWorldSwing");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    //Add the ubiquitous "Hello World" label.
    JLabel label = new JLabel("Hello World");
    frame.getContentPane().add(label);
    //Display the window.
    frame.pack();
    frame.setVisible(true);
    public static void main(String[] args) {
    //Schedule a job for the event-dispatching thread:
    //creating and showing this application's GUI.
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    createAndShowGUI();
    But I got the following error,
    C:\j2sdk1.4\bin>javac HelloWorldSwing.java
    HelloWorldSwing.java:2: package javax.awt does not exist
    import javax.awt.*;
    ^
    HelloWorldSwing.java:9: cannot resolve symbol
    symbol : constructor JFrame (java.lang.String)
    location: class JFrame
    JFrame frame = new JFrame("HelloWorldSwing");
    ^
    2 errors
    Does Jdk1.4 is not compatible for executing Swing applications?
    Thanks in advance.

    How long have you been using Java? Swing has been in the javax.swing package for a long time now.
    Your compiler errors don't match your source:
    import javax.swing.*;
    vs
    C:\j2sdk1.4\bin>javac HelloWorldSwing.java
    HelloWorldSwing.java:2: package javax.awt does not exist
    import javax.awt.*;

Maybe you are looking for

  • Does SBS 2003 need M$SQL Server?

    Hi All, I have just picked up a new customer with SBS2003.  (I can not tell if it is R1 or R2.)  He is using it primarily as an Exchange Server and to share files with Quick Books.  The server has M$SQL 2005 installed on it.  The server is "refurbish

  • Photoshop not installed on my computer and won't install.

    A month ago I purchased the Photoshop lightroom package for 9.99 a month.  I downloaded creative cloud and both photoshop and lightroom programs to my computer.  They worked fine. Then I ended up with a virus (from a different source) that required m

  • J2ee Ejb specification 2.0

    Hi, The latest Specifications for EJB 2.0 available on Sun's site talks about Entity Bean - bean managed persistance in Chapter 12 (page 257 - 258), where it states that Bean Method bean method can perform operations ---------------------------------

  • Macbook Pro shuts down during boot

    Hi there, Few days ago I spilled some beer on my 2 weeks old Macbook Pro... I immediately cleaned it, removed the battery and charger and left it to dry for 1.5 day. After the drying period I tried to power up the machine, it did work but unfortutane

  • HT1918 my games won't open on my ipod how do i fix this?

    Hello i cannot get my games to open on my grand daughters ipod they just blink when you click on them but don;t open how can i fix this?