Help for a java swing

I created a Swing application and I have to add a help menu (a standard help like the one any Windows application has).
Any suggestions,
Thanks

This I know.
But what are the classes I have to use in order to create and display the help as the one you have in IE, for example.
Press F1 to any application and you will understand what I mean

Similar Messages

  • Help for a java Newbie please!

    Hey guys I'm writing this program for my Java 1 class I can't seem to get it complie. This is the first time we've worked with building out own classes. And I have a feeling that I'm doing something small and silly. If someone could just take a look at it I'd be more than happy.
    This is the Class we had to write it has 4 different fields of "employee information" This one looks fine.
    public class Employee
       private String name;           
       private int idNumber;      
       private String department;
       private String position;
       public Employee(String theName, int theIdNumber, String theDepartment,
                        String thePosition)
             name = theName;
             idNumber = theIdNumber;
             department = theDepartment;
             position = thePosition;
       public void setName( String theName )
             name = theName;
       public void setIdNumber( int theIdNumber )
                idNumber = theIdNumber;
       public void setDepartment( String theDepartment )
                department = theDepartment;
       public void setPosition( String thePosition )
                position = thePosition;
       public String getName()
                return name;
      public int getIdNumber()
                return idNumber;
      public String getDepartment()
                  return department;
      public String getPosition()
                 return position;
    } I think this one is good, it compiles just fine.
    Now we had to write a program that accesses the class and store "employee information" for 3 different employees and recall it. It only recalls for one right now, it doesn't compile though... sad day. Any help would be AMAZING THANKS in advanced.
    import javax.swing.JOptionPane;
    public class EmployeeInfo
       public static void main(String[] args)
           String firstEmployeeName = "Susan Meyers";
           String secondEmployeeName = "Mark Jones" ;
           String thridEmployeeName = "Joy Rogers";
           int firstEmployeeId = 47899;
           int secondEmployeeId = 39119;
           int thirdEmployeeId = 81774;
           String firstEmployeeDepartment = "Accounting";
           String secondEmployeeDepartment = "IT";
           String thirdEmployeeDepartment = "Manufacturing";
           String firstEmployeePosition = "Vice President";
           String secondEmployeePosition = "Programmer";
           String thirdEmployeePosition = "Engineer";
           Employee Employee1 = new Employee();
           Employee1.setName(firstEmployeeName);
           Employee1.setIdNumber(firstEmployeeId);
           Employee1.setDepartment(firstEmployeeDepartment);
           Employee1.setPosition(firstEmployeePosition);
           Employee Employee2 = new Employee();
           Employee2.setName(secondEmployeeName);
           Employee2.setIdNumber(secondEmployeeId);
           Employee2.setDepartment(secondEmployeeDepartment);
           Employee2.setPosition(secondEmployeePosition);
           Employee Employee3 = new Employee();
           Employee3.setName(thirdEmployeeName);
           Employee3.setIdNumber(thirdEmployeeId);
           Employee3.setDepartment(thirdEmployeeDepartment);
           Employee3.setPosition(thirdEmployeePosition);
           JOptionPane.showMessageDialog(null, "Name          ID Number   " +
                                         "Department      Position     /n" +
                                         Employee1.getName() + "   " +
                                         Employee1.getIdNumber() + "   " +
                                         Employee1.getDepartment() + "      /n");
      System.exit(0);
    }

    Also the compiling error I get is
    O:\HomeWork\CIS 260\Assignment 5\EmployeeInfo.java:28: cannot find symbol
    symbol  : constructor Employee()
    location: class Employee
           Employee Employee1 = new Employee();
                                   ^
    O:\HomeWork\CIS 260\Assignment 5\EmployeeInfo.java:39: cannot find symbol
    symbol  : constructor Employee()
    location: class Employee
           Employee Employee2 = new Employee();
                                   ^
    O:\HomeWork\CIS 260\Assignment 5\EmployeeInfo.java:50: cannot find symbol
    symbol  : constructor Employee()
    location: class Employee
           Employee Employee3 = new Employee();
                                   ^
    O:\HomeWork\CIS 260\Assignment 5\EmployeeInfo.java:52: cannot find symbol
    symbol  : variable thirdEmployeeName
    location: class EmployeeInfo
           Employee3.setName(thirdEmployeeName);
                                ^
    4 errors

  • Crystal Report for Eclipse - Java SWING - JDBC Examples?

    <p>Good day! I am just a newbie in Java Programming and I am wondering if there is an example application in SWING-JDBC w/reports that uses Crystal reports w/ Eclipse IDE. As what I have noticed, all of the examples I have seen here are all in jsp and I havent seen anything for swing-jdbc only. I want to try using crystal reports in java. </p><p>&#160;</p><p>Do you guys have some examples (even a very simple one) that uses crystal reports with Eclipse and even with a simple database like Access? Any sample, tutorial downloads with this topic? hope you guys can help. thank you very much and God bless.</p>

    Crystal Reports doesn't have the same niece tooling for desktop/swing applications that it does for JSP/Web applications. That said you can still create reports with CR4Eclipse and use them in a Swing applications. Try out these samples that I posted. They are all desktop/swing applications. These will work with Eclipse.
    [http://diamond.businessobjects.com/node/707 | /node/707]
    [http://diamond.businessobjects.com/node/335 | /node/335]
    Hopefully this is helpful.
    Rob Horne
    Rob's blog - http://diamond.businessobjects.com/blog/10</p>

  • Desperate need of HELP for a Java GUI !

    Hy people,
    I am working on a project trying to display a GUI where its output is dependant on the user's input.
    Here is a brief example of what Im trying to do:
    You have a GUI that contains 2 panels. buttonPanel and DisplayPanel.
    buttonPanel contains:
    a dropdown list: includes choices of colors,
    2 textfields: the length: (can enter from 1 to 100),
    the width: (can enter from 1 to 100),
    a checkbox: random
    and a start button.
    Now when I enter ALL the information needed in the components and then press start button, it should display its result in the DisplayPanel.
    In my case, I want to display just one rectangle to start off. That will have its color changed by the dropdown choice made. Now Im forgetting about the length and width textfield for now cause that will be incorporated for something else later on.
    I created a buttonLitener for the start button and an ItemListener for the dropDown List.
    I declared and drew a rectangle specific to the color chosen by the user in a class I created called DrawingCanvas that extends Canvas and that overrides the paint method.
    BUT My problem is that it does not display the rectangle I created in my DisplayPanel when I press on the Start button.
    I provided a screenshot of the GUI interface, and my 2 java files. Is someone brave enough to fix my problem or even tell me what Im doing wrong ?!
    ScreenShot:
    http://www.hybrid.concordia.ca/~boumbo/GUIProblem.jpg
    Java Files:
    http://www.hybrid.concordia.ca/~boumbo/GUI.zip]Java Files
    PLEASE I am not Amazing with Java, and pulling my hair out in figuring out my problem.
    Thank you.

    Seriously, look at the first reply in the following thread. It gives a pretty good idea of generally accepted good practices in the forum.
    http://forum.java.sun.com/thread.jspa?threadID=603683
    It is probably better to post code directly on the forum than to try to get people to take the extra steps to download, unzip, and compile your code. That way, they can just cut and paste to try to compile. Be sure to use [code][/code] tags to make your code easier to use. And, try to provide a small example of your problem if the code is very long or complex.
    Another piece of advice. Don't try to challenge the regulars in this forum to prove that they are smart enough, brave enough, whatever enough to tackle YOUR problem. The regulars here include software engineers, authors, and generally very smart and experienced people They don't need to prove themselves to anyone.
    What they want to see is that you have genuinely tried to understand your problem, rather than just running to the forum the first time you get a compiler error.
    You seem to have been working on this problem. Go ahead and create a test case that shows what the problem is. Quite frequently, just doing that will help you solve the problem yourself.
    Good luck.
    RD-R
    � {�
    Mon Mar 07 00:57:45 EST 2005
    Pseudo-random saying number 257 of 635
    For every complex problem, there is a solution that is simple, neat,
    and wrong.
                    -- Henry Louis Mencken

  • Steps to setup for my  Java Swing Desktop Application on Macintosh

    hi guys,
    I need help from all of u to create the setup for my Desktop application (developed in swings) on Macintosh. pls give me the references at least. how to approach the tools.
    its urgent...please....
    thanks in advance.
    -siva

    hi guys,
    I need help from all of u to create the setup for my Desktop application (developed in swings) on Macintosh. pls give me the references at least. how to approach the tools.
    its urgent...please....
    thanks in advance.
    -siva

  • Need help for downloading java at mac book retina

    i want to download java at my mac book pro retina but everytime we downloaded its not working..i need this because im going to use it to open my bank account...everytime i gonna check my bank account i need to use another computer not this my mac.why?? can you help me please.

    Banks do NOT use Java-in-a-Browser for anything, at all. If you have received a suggestion to conduct banking with JAVA enabled in your Browser, someone is attempting to commit a crime, with you as the intended victim.  You are being scammed and should report it to the Police.

  • Help for a java newbie - JPanel

    Well, im in my 3rd year of university and just started java... After 2 years of Ada, im quite happy ;)
    My problem is when creating a class for drawing a train. I extend JPanel and have a paint component,. However when i extend the class for drawing a train, it doesnt call the new paint component!!!
    Does anyone know what im doing wrong. I suspect it may be due to drawpane only being in the superclass... ?
    <CODE>
    * This code is based on a Swing tutorial example that was
    * in turn based on an example program provided by John Vella.
    import javax.swing.*;
    import javax.swing.event.MouseInputAdapter;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    class DrawTrain extends JFrame
    public DrawPane drawArea; //PRIVATE // Provides the drawing area.
    private RSUnit[] train;
    public int scaleFactor = 1; //PRIVATE
    private class WindowHandler extends WindowAdapter
    public void windowClosing (WindowEvent we)
    // dispose(); // Frees program frame resources.
    System.exit(0); // Stops the program normally.
    } //windowClosing
    } //class WindowHandler
    protected class DrawPane extends JPanel
    protected void paintComponent (Graphics g)
    super.paintComponent(g);
    g.setColor(Color.BLUE);
    int offset = 20;
    for (int i = 0; i < train.length; i++) {
    int tempLOB = 250;
    int tempHMX = 100;
    g.fillRect(offset, 20, scaleFactor*tempLOB,scaleFactor*tempHMX);
    offset = offset + tempLOB + 20;
    // System.out.println(offset);
    // System.out.println(tempLOB);
    // System.out.println(tempHMX);
    // for (int i = 0; i < train.length; i++) {
    // System.out.println((train.desc).lob);
    // System.out.println((train.desc).hmx);
    } //paintComponent
    } //class DrawPane
    public DrawTrain (RSUnit[] train)
    this.train = train;
    setTitle("ScrollDemo");
    //ovalBool = false;
    JPanel mainPane= new JPanel();
    mainPane.setOpaque(true);
    setContentPane(mainPane);
    // Sets-up the instruction pane:
    JPanel instructPanel= new JPanel(new GridLayout(0,1));
    JLabel instructMain=
    new JLabel("Click main mouse button to place a circle.");
    JLabel instructAlt=
    new JLabel("Click alt. mouse button to clear drawing area.");
    instructPanel.add(instructMain);
    instructPanel.add(instructAlt);
    // Sets-up the drawing area:
    drawArea= new DrawPane();
    drawArea.setBackground(Color.white);
    drawArea.setPreferredSize(new Dimension(10000,10000));
    // Puts the drawing area in a scroll pane:
    JScrollPane scroller= new JScrollPane(drawArea);
    scroller.setPreferredSize(new Dimension(500,500));
    // Lays-out the main panel:
    mainPane.setLayout(new BorderLayout());
    mainPane.add(instructPanel,BorderLayout.NORTH);
    mainPane.add(scroller,BorderLayout.CENTER);
    addWindowListener(new WindowHandler());
    pack();
    setVisible(true);
    } //constructor
    public static void main (String args[])
    RSUnit[] train2=
    new Loco (TTDescs.ldesc),
    new Tender(TTDescs.tdesc),
    new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc),
    new Wagon (TTDescs.wdesc),
    new Wagon (TTDescs.wdesc),
    new Wagon (TTDescs.wdesc),
    new Wagon (TTDescs.wdesc),
    new Wagon (TTDescs.wdesc),
    new Wagon (TTDescs.wdesc)
    DrawTrain DD = new DrawTrain(train2);
    DD.scaleFactor =2;
    DD.drawArea.repaint();
    try {
    Thread.sleep(100); } catch(InterruptedException ie) {}
    DD.scaleFactor =3;
    DD.drawArea.repaint();
    try {
    Thread.sleep(100); } catch(InterruptedException ie) {}
    DD.scaleFactor =2;
    DD.drawArea.repaint();
    try {
    Thread.sleep(100); } catch(InterruptedException ie) {}
    DD.scaleFactor =3;
    DD.drawArea.repaint();
    } //main
    } //class SimpleScrollDemo
    </CODE>
    <CODE>
    import javax.swing.*;
    import javax.swing.event.MouseInputAdapter;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    class DrawOvalOnTrain extends DrawTrain {
    private Pos2D ovalPos;
    private boolean ovalBool;
    private class DrawOvalOnPane extends DrawTrain.DrawPane {
    protected void paintComponent (Graphics g) {
    super.paintComponent(g);
    System.out.println("Hi");
    if (ovalBool) {
    g.drawOval((int)(ovalPos).x, (int)(ovalPos).y, 5, 5);
    protected class MyMouseListener extends MouseInputAdapter
    public void mouseReleased (MouseEvent me)
    if (SwingUtilities.isRightMouseButton(me))
    ovalBool = false;
    else
    int x= me.getX();// - dia/2; if (x < 0) x= 0;
    int y= me.getY();// - dia/2; if (y < 0) y= 0;
    //fix to do between each train
    //perhaps, if clicked again and ovalBool = true, then take away circle
    if ((x >= 270) && (x < 370) && (y >=20) && (y <=120)) {
    ovalPos = new Pos2D((float)x,(float)y);
    ovalBool = true;
    System.out.println(ovalPos);
    // Saves the new rectangle.
    } //if
    drawArea.repaint();
    } //mouseReleased
    } //class MyMouseListener
    DrawOvalOnTrain(RSUnit[] train) {
    super(train);
    drawArea.addMouseListener(new MyMouseListener());
    ovalBool = false;
    public static void main (String[] args) {
    RSUnit[] train2=
    new Loco (TTDescs.ldesc),
    new Tender(TTDescs.tdesc),
    new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc),
    new Wagon (TTDescs.wdesc),
    new Wagon (TTDescs.wdesc),
    new Wagon (TTDescs.wdesc),
    new Wagon (TTDescs.wdesc),
    new Wagon (TTDescs.wdesc),
    new Wagon (TTDescs.wdesc)
    new DrawOvalOnTrain(train2);
    System.out.println("HI");
    </CODE>

    It looks like you're doing this the wrong way round, extending DrawPane, but creating an instance of DrawPane,
    instead of DrawOvalOnPane.
    see if this small example makes any sense
    (switch between creating instances of DrawPanel and DrawPanelTwo, and see the difference)
    import java.awt.*;
    import javax.swing.*;
    class Testing extends JFrame
      DrawPanel dp = new DrawPanel(); //toggle these to see the difference
      //DrawPanelTwo dp = new DrawPanelTwo();
      public Testing()
        setLocation(200,100);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        setSize(600,300);
        getContentPane().add(dp);
      public static void main(String[] args){new Testing().setVisible(true);}
    class DrawPanel extends JPanel
      public void paintComponent(Graphics g)
        super.paintComponent(g);
        g.drawRect(50,50,250,150);
    class DrawPanelTwo extends DrawPanel
      public void paintComponent(Graphics g)
        super.paintComponent(g);
        g.drawOval(350,50,150,150);
    }

  • Help for a java newbie

    Well, im in my 3rd year of university and just started java... After 2 years of Ada, im quite happy ;)
    My problem is when creating a class for drawing a train. I extend JPanel and have a paint component,. However when i extend the class for drawing a train, it doesnt call the new paint component!!!
    Does anyone know what im doing wrong. I suspect it may be due to drawpane only being in the superclass... ?
    <CODE>
    * This code is based on a Swing tutorial example that was
    * in turn based on an example program provided by John Vella.
    import javax.swing.*;
    import javax.swing.event.MouseInputAdapter;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    class DrawTrain extends JFrame
    public DrawPane drawArea; //PRIVATE // Provides the drawing area.
    private RSUnit[] train;
    public int scaleFactor = 1; //PRIVATE
    private class WindowHandler extends WindowAdapter
    public void windowClosing (WindowEvent we)
    // dispose(); // Frees program frame resources.
    System.exit(0); // Stops the program normally.
    } //windowClosing
    } //class WindowHandler
    protected class DrawPane extends JPanel
    protected void paintComponent (Graphics g)
    super.paintComponent(g);
    g.setColor(Color.BLUE);
    int offset = 20;
    for (int i = 0; i < train.length; i++) {
    int tempLOB = 250;
    int tempHMX = 100;
    g.fillRect(offset, 20, scaleFactor*tempLOB,scaleFactor*tempHMX);
    offset = offset + tempLOB + 20;
    // System.out.println(offset);
    // System.out.println(tempLOB);
    // System.out.println(tempHMX);
    // for (int i = 0; i < train.length; i++) {
    // System.out.println((train.desc).lob);
    // System.out.println((train[i].desc).hmx);
    } //paintComponent
    } //class DrawPane
    public DrawTrain (RSUnit[] train)
    this.train = train;
    setTitle("ScrollDemo");
    //ovalBool = false;
    JPanel mainPane= new JPanel();
    mainPane.setOpaque(true);
    setContentPane(mainPane);
    // Sets-up the instruction pane:
    JPanel instructPanel= new JPanel(new GridLayout(0,1));
    JLabel instructMain=
    new JLabel("Click main mouse button to place a circle.");
    JLabel instructAlt=
    new JLabel("Click alt. mouse button to clear drawing area.");
    instructPanel.add(instructMain);
    instructPanel.add(instructAlt);
    // Sets-up the drawing area:
    drawArea= new DrawPane();
    drawArea.setBackground(Color.white);
    drawArea.setPreferredSize(new Dimension(10000,10000));
    // Puts the drawing area in a scroll pane:
    JScrollPane scroller= new JScrollPane(drawArea);
    scroller.setPreferredSize(new Dimension(500,500));
    // Lays-out the main panel:
    mainPane.setLayout(new BorderLayout());
    mainPane.add(instructPanel,BorderLayout.NORTH);
    mainPane.add(scroller,BorderLayout.CENTER);
    addWindowListener(new WindowHandler());
    pack();
    setVisible(true);
    } //constructor
    public static void main (String args[])
    RSUnit[] train2=
    new Loco (TTDescs.ldesc),
    new Tender(TTDescs.tdesc),
    new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc),
    new Wagon (TTDescs.wdesc),
    new Wagon (TTDescs.wdesc),
    new Wagon (TTDescs.wdesc),
    new Wagon (TTDescs.wdesc),
    new Wagon (TTDescs.wdesc),
    new Wagon (TTDescs.wdesc)
    DrawTrain DD = new DrawTrain(train2);
    DD.scaleFactor =2;
    DD.drawArea.repaint();
    try {
    Thread.sleep(100); } catch(InterruptedException ie) {}
    DD.scaleFactor =3;
    DD.drawArea.repaint();
    try {
    Thread.sleep(100); } catch(InterruptedException ie) {}
    DD.scaleFactor =2;
    DD.drawArea.repaint();
    try {
    Thread.sleep(100); } catch(InterruptedException ie) {}
    DD.scaleFactor =3;
    DD.drawArea.repaint();
    } //main
    } //class SimpleScrollDemo
    </CODE>
    <CODE>
    import javax.swing.*;
    import javax.swing.event.MouseInputAdapter;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    class DrawOvalOnTrain extends DrawTrain {
    private Pos2D ovalPos;
    private boolean ovalBool;
    private class DrawOvalOnPane extends DrawTrain.DrawPane {
    protected void paintComponent (Graphics g) {
    super.paintComponent(g);
    System.out.println("Hi");
    if (ovalBool) {
    g.drawOval((int)(ovalPos).x, (int)(ovalPos).y, 5, 5);
    protected class MyMouseListener extends MouseInputAdapter
    public void mouseReleased (MouseEvent me)
    if (SwingUtilities.isRightMouseButton(me))
    ovalBool = false;
    else
    int x= me.getX();// - dia/2; if (x < 0) x= 0;
    int y= me.getY();// - dia/2; if (y < 0) y= 0;
    //fix to do between each train
    //perhaps, if clicked again and ovalBool = true, then take away circle
    if ((x >= 270) && (x < 370) && (y >=20) && (y <=120)) {
    ovalPos = new Pos2D((float)x,(float)y);
    ovalBool = true;
    System.out.println(ovalPos);
    // Saves the new rectangle.
    } //if
    drawArea.repaint();
    } //mouseReleased
    } //class MyMouseListener
    DrawOvalOnTrain(RSUnit[] train) {
    super(train);
    drawArea.addMouseListener(new MyMouseListener());
    ovalBool = false;
    public static void main (String[] args) {
    RSUnit[] train2=
    new Loco (TTDescs.ldesc),
    new Tender(TTDescs.tdesc),
    new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc), new Wagon (TTDescs.wdesc),
    new Wagon (TTDescs.wdesc),
    new Wagon (TTDescs.wdesc),
    new Wagon (TTDescs.wdesc),
    new Wagon (TTDescs.wdesc),
    new Wagon (TTDescs.wdesc),
    new Wagon (TTDescs.wdesc)
    new DrawOvalOnTrain(train2);
    System.out.println("HI");
    </CODE>

    First, use the [url http://forum.java.sun.com/features.jsp#Formatting]format tags to find the tags for formatting code.
    As for your problem with the new paintComponent, you never create an instance of DrawOvalOnPane. The main panel is still just a DrawPane unless you specifically add the new one. However, with the way you have set this up, just calling the DrawTrain constructor in your subclass will result in a normal DrawPane to be used. You'll have to tell the scrollpane to change it's viewport component to be an instance of the subclassed pane.
    I hope that wasn't too confusing. Best of luck!
    -JBoeing

  • Seek help for install java under linux

    I have successfully installed java on linux , but not able to use many features tht i possibly could , such as jdbc , prblms on Mysql. most buggin prblm how do i set the compiler path to compile files from my home directory. i have to forcefully use the bin directory and run the complier given long address for the files. plz help.
    abhi

    abhi
    I don't know about your MySQL problems based on what you have posted - can you post any more specific information? Have you got the relevant MySQL drivers in your classpath? The drivers are available here:
    http://www.mysql.com/downloads/download.php?file=Downloads/Connector-J/mysql-connector-java-2.0.14.tar.gz
    the README in that file will give you installation instructions.
    how do i set the compiler path to compile files from my home directorySet the CLASSPATH environment variable to include whichever directories you like, eg (on bash) type:
    export CLASSPATH=$CLASSPATH:.:<your java dirs>To make java easier to run, put the directory in which it is installed into your path:
    export JAVA_HOME=<where you installed java>Then do
    export PATH=$PATH:$JAVA_HOME/binverify it has worked by simply typing
    javaYou can put all of these commands into the .*rc file for your shell, so that they are executed every time you open the shell. So if you are using bash you can put them into ~/.bashrc
    Read up setting the PATH and CLASSPATH for more info.
    HTH
    Matt

  • Need help for a java assignment

    i am having trouble with my java assignment, so i thought i will give it a try here and hope that i will get some help. ^^
    the method is to load a file and try to create an object out of it. but even though the sequence of loading is correct, the method still doesn't work. there is no error in compilation and the coding seems correct to me. help?
    the codes are below and if any other code is needed. ask me for it. =)
    public void saveToFile(String fileName)
    try
    File f = new File(fileName);
    PrintWriter p = new PrintWriter(f);
    p.println(fileName);
    p.println("***");
    for(int i =0; i<categories.length; i++)
    if(categories[i] != null)
    p.print(categories.getCatNum());
    Car[] x = categories[i].getListOfCars();
    for(int q=0; q<x.length;q++)
    if(x[q] != null)
    if(x[q] instanceof EconomyCar)
    p.print("Economy Car");
    x[q].getCarNum();
    x[q].getBrand();
    x[q].getPrice();
    else if(x[q] instanceof LuxuryCar)
    p.print("Luxury Car");
    x[q].getCarNum();
    x[q].getBrand();
    x[q].getPrice();
    else if(x[q] instanceof SportCar)
    p.print("Sport Car");
    x[q].getCarNum();
    x[q].getBrand();
    x[q].getPrice();
    p.println(x[q].getCarNum());
    p.println(x[q].getBrand());
    p.println(x[q].getPrice());
    p.close();
    catch(IOException e)
    System.out.println("IO Error");
    public void loadFromFile(String fileName)
    try
    File file = new File(fileName);
    Scanner sc = new Scanner(file);
    String shopName = sc.nextLine();
    CarMart Cm = new CarMart(shopName);
    while(sc.hasNextLine());
    String line = sc.nextLine();
    while(line.equals("***"));
    int CateNum = sc.nextInt(); sc.nextLine();
    Category Cate = new Category(CateNum);
    String typeOfCar = sc.nextLine();
    if(typeOfCar.equals("Economy Car"))
    String CarNum = sc.nextLine();
    String brand = sc.nextLine();
    double price = sc.nextDouble(); sc.nextLine();
    EconomyCar e = new EconomyCar(CarNum, brand, price);
    else if(typeOfCar.equals("Luxury Car"))
    String CarNum = sc.nextLine();
    String brand = sc.nextLine();
    double price = sc.nextDouble(); sc.nextLine();
    LuxuryCar l = new LuxuryCar(CarNum, brand, price);
    else if(typeOfCar.equals("Sport Car"))
    String CarNum = sc.nextLine();
    String brand = sc.nextLine();
    double price = sc.nextDouble(); sc.nextLine();
    SportCar s = new SportCar(CarNum, brand, price);
    sc.close();
    catch(FileNotFoundException a)
    System.out.println("Filename not found");

    morgalr wrote:
    erm. its supposed to save a file containing all the data of a car. then the loadFromFile method is supposed to load that file and create a car out of it.I want one, could you please make mine a Dodge Viper.A fascinating insight into your secret worries about your masculinity :)

  • Help for using java class in forms 9i

    hi
    i have been trying to use java class in forms9i but unable to execute ,i have encountered exceptions,for which exception handlers have been declared like ora_java.java_error and exception_thrown but failed to handle run time errors , i have tried all ways from my side.
    my java class returns a simple string
    i need help on various work arounds
    thanks in advance
    yash

    sir
    i have written a simple java class which returns a string hello imported using a java importer in forms 9i
    and i call my class in when button press trigger
    i have also imported java.lang.Exception for my exception handlers,i have no compile errors,but when i run my forms i get run time error and my exception handlers fail to trap it . ihave no idea how to proceed .
    should i use bean area in form and call the class using fbean from custom item rigger if so please explain
    can i get sample code example for calling a java class methods from forms.
    thanks
    yash

  • Need Help For Developing Java Network RPG

    Greetings,
    Did anyone develop any similar game?I'm developing one for my final year project and i need some guidelines on that.
    Thanks for your help in advanced.
    Cheers,
    yc

    Since you are making a 2D game I suppose that speed is not really important. Don't make it too hard on yourself and use objectstreams.
    first thing you need is a class which holds all the variables you want to send (like position, health, whatever) and let it implement the "Serializable" interface.
    next stop: the client side connection
    socket     = new Socket(ipaddress, port);     
    obi = new ObjectInputStream(socket.getInputStream());
    obu = new ObjectOutputStream(socket.getOutputStream());and the server side connection:
    ServerSocket s = new ServerSocket(port);
    while(true) { // keep accepting new connections
    socket = s.accept();
    obu = new ObjectOutputStream(socket.getOutputStream());
    obi = new ObjectInputStream(socket.getInputStream());
    }make sure you turn around output and input. The server won't continue unless his output has input on the clientside.
    with the objectoutputsstream you can send the objects:
    obu.writeObject(netData);
    obu.flush();
      // make sure you flushreceiving the object:
    netData = (YourNetData) oi.readObject();so what you need is a client side function that sends objects, a client side thread that handles received objects.
    The easiest way to make a server is making an array of client threads and put the socket and the objectstreams in the thread. The thread can read an incoming object and send it to all clients in the array. This way you never have to change your server, you only have to change the object you send.

  • Help for using Java Time

    My code is as the following:
    String time = "22/May/2008:00:09:44 -0400";
    String strDF1     = "dd/MMM/yyyy:HH:mm:ss Z";
    SimpleDateFormat sdf1 = new SimpleDateFormat( strDF1 );
    Date d1     = ( Date ) sdf1.parse( time );
    System.out.println( d1.toString() );
    String srtDF2     = "yyyy-mm-dd HH:mm:ss Z";
    SimpleDateFormat sdf2 = new SimpleDateFormat( srtDF2 );
    String newTime     = sdf2.format( d1 );
    System.out.println( newTime );
    The output is
    Thu May 22 00:09:44 EDT 2008
    2008-09-22 00:09:44 -0400
    So, you see, the format is correctly changed, but the time is wrong.
    Please help...
    Thanks,
    Paul
    Edited by: paulur_lee on Aug 8, 2008 10:28 PM

    you are right
    Letter Date or Time Component Presentation Examples
    G Era designator Text AD
    y Year Year 1996; 96
    M Month in year Month July; Jul; 07
    w Week in year Number 27
    W Week in month Number 2
    D Day in year Number 189
    d Day in month Number 10
    F Day of week in month Number 2
    E Day in week Text Tuesday; Tue
    a Am/pm marker Text PM
    H Hour in day (0-23) Number 0
    k Hour in day (1-24) Number 24
    K Hour in am/pm (0-11) Number 0
    h Hour in am/pm (1-12) Number 12
    m Minute in hour Number 30
    s Second in minute Number 55
    S Millisecond Number 978
    z Time zone General time zone Pacific Standard Time; PST; GMT-08:00
    Z Time zone RFC 822 time zone -0800
    http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html

  • HELP for Compile java programe !

    Hello All,
    i want to make java programe by which i can compile java programes
    and when i compile java programe from my programe then
    i shoul get compiled status means programe compile successfuly
    or not compile.
    if any example i m thanksfull.
    onlyforjava.

    how about if compile fail?
    the process obj seems return value 0 as it run successful.
    I haven't try this, but I have experienced the process obj returns 0 if the executed command has some routine to handle error cases, in which, error will not halt the system.
    So, I recommand the following scenario.
    1. let say, if your java is test.java. check the existence of file test.class.
    If, it exists, get its modified time.
    2. compile the java code with
    Procress p = Runtime.exec(new String[]{"javac", "test.java"});
    3. get the error string if any.
    InputStream in = new BufferedInputStream(p.getInputStream());int read;while ((read = in.read()) != -1){  System.out.println((char)read);}
    4. handle error with the exitValue
    if (p.exitValue() != 0){  System.out.println("warning.");}
    5. check again the file test.class if it is a newly created file.
    6. if it is newly created, compile success. Else, failed.

  • Help for simple java question

    May i know how to set the image .jpg or gif into the label ?
    how to get the time in this format::Monday 12th Jan 2004
    thanks

    Hi,
    If i want click the button then the image of the JLabel will be change.. how to write in syntax?
    i know the c1 = new JLabel(new ImageIcon("sysImage/Send.gif"));
    but i want another image after click command button.
    is it c1.setImageIcon("abc.gif"); ? i try,but error..
    how to apply the date fill into syntax? i not really know read the API
    thanks

Maybe you are looking for

  • Error Message while creating connection pool

    Hi all, I got the following error message while creating connection pool for the SQL Server thru the Application Server Admin Console. The message is, An error has occured. Operation 'create.Jdbc.ConnectionPool' failed in 'resources' Config Mbean. Ta

  • DVD burner no longer burns...

    Hello, Did a little research and followed some solutions but to no avail... I have Roxio installed and has co-existed w/ Encore without problems up until just recently... I don't know what has changed as I don't shange the system much... For some rea

  • HP Laserjet P4014dn won't auto print from tray 1

    HP Laserjet P4014dn stopped auto printing from tray 1. Can't manually print from there either. Now it always pulls from tray 2 (bottom tray) even if paper is loaded in tray 1. Auto print is selected in software setting. SN [Personal Information Remov

  • Pen tool and masking in cs6.

    In previous versions I could create a custom (vector) mask using the pen tool in 2 easy steps. Draw a shape then drag that shape to the image i wanted the mask on. Done. This "feature" has been removed from CS6 and its extremely annoying. Or has it j

  • MBP Display flickers upon boot-up

    Hi guys, My macbook pro (mid 2012) has started flickering badly upon boot-up. The display also jiggles up and down on occassion when loading web pages. I have upgraded to Mavericks and my MBP is usually hooked up to a large monitor.  Problem just sta