Results 1 to 13 of 13

Thread: HTML and Java GUIs D:

  1. #1
    Recognized Member Jessweeee♪'s Avatar
    Join Date
    Jul 2005
    Location
    i'm on a sandbar help
    Posts
    19,881
    Blog Entries
    12

    FFXIV Character

    Sarangerel Qha (Twintania)
    Contributions
    • Former Cid's Knight
    • Former Site Staff

    Default HTML and Java GUIs D:

    Help! Is there a way to put a GUI coded in Java into a web page without turning it into an applet?

    We're working on this project at school. I had to tell the programmers I only knew how to put applets in, and they're having a little trouble turning it into one x.x

  2. #2
    Old school, like an old fool. Flying Mullet's Avatar
    Join Date
    Apr 2003
    Location
    Napping in a peach tree.
    Posts
    19,185
    Articles
    6
    Blog Entries
    7
    Contributions
    • Former Administrator
    • Former Cid's Knight
    • Former Senior Site Staff

    Default

    Most likely not. Java GUI's (AWT and Swing) and HTML are completely different languages with completely different architectures.
    Figaro Castle

  3. #3
    i n v i s i b l e Tech Admin o_O's Avatar
    Join Date
    Jun 2001
    Location
    New Zealand
    Posts
    2,957
    Blog Entries
    1

    FFXIV Character

    Humphrey Squibbles (Sargatanas)

    Default

    Unfortunately there isn't, as far as I know. You could include limited Java functionality in the GUI of the web page by using JSP with the Tomcat webserver but that wouldn't allow for the creation of JPanels and JFrames and whatnot. As long as the main class of the Java program extends the Applet superclass then there shouldn't be a lot more to change though. Perhaps if you had more detail on what issues they're having somebody here could help?

  4. #4
    diafnaoplzkthnxbai NeoTifa's Avatar
    Join Date
    Jun 2005
    Location
    in psy's panties <3
    Posts
    3,411

    Default

    No, applets were made spacifically for this reason. :\
    Oh gods, why? ಥ_ಥ


  5. #5
    Recognized Member Jessweeee♪'s Avatar
    Join Date
    Jul 2005
    Location
    i'm on a sandbar help
    Posts
    19,881
    Blog Entries
    12

    FFXIV Character

    Sarangerel Qha (Twintania)
    Contributions
    • Former Cid's Knight
    • Former Site Staff

    Default

    Okay, so this is what it looks like so far.

    Code:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.applet.*;
    
    public class MakingBank extends JApplet
    {
    
        public static void main(String[] args)
        {
    
            JFrame frame = new JFrame();
            JPanel panel2 = new JPanel();
            panel.add(name);
            panel.add(nameIGuess);
            panel.add(address);
            panel.add(place);
            
            final PressButton john = new PressButton();
            
            
            
            
            panel.add(pine, BorderLayout.CENTER);
            panel.add(fresh);
            panel.add(pine2, BorderLayout.CENTER);
            panel.add(fresh2);
            panel.add(pine3, BorderLayout.CENTER);
            panel.add(fresh3);
            panel.add(pine4, BorderLayout.CENTER);
            panel.add(fresh4);
            panel.add(enter);
            panel.add(reciept);
            
            panel.setBackground(background);
            frame.add(panel);
            frame.setTitle("Bank");
            enter.addActionListener(PressButton.listener);
            
           
           
           
            
            fresh.setText("0");
            fresh2.setText("0");
            fresh3.setText("0");
            fresh4.setText("0");
            
            reciept.setEditable(false);
            
            place.setBackground(Color.WHITE);
            nameIGuess.setBackground(Color.WHITE);
            fresh.setBackground(Color.WHITE);
            fresh2.setBackground(Color.WHITE);
            fresh3.setBackground(Color.WHITE);
            fresh4.setBackground(Color.WHITE);
            reciept.setBackground(Color.WHITE);
            
            frame.setSize(650, 650);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);
    
    }
            public static Color background = Color.GRAY;
           
        
           public static final JLabel name = new JLabel("Name: ");
           public static final JTextField place = new JTextField(50);
           public static final JLabel address = new JLabel("Address: ");
           public static final JTextArea reciept = new JTextArea(10, 30);
           
           public static final JTextField nameIGuess = new JTextField(50);
           public static final JLabel pine = new JLabel("Pine Tree Air Freshener ($9.99): ");
           public static JTextField fresh = new JTextField(50);
           public static final JLabel pine2 = new JLabel("Pine Tree Cologne ($10.99): ");
           public static final JTextField fresh2 = new JTextField(50);
           public static final JLabel pine3 = new JLabel("Pine Tree Puppets ($5.99): ");
           public static final JTextField fresh3 = new JTextField(50);
           public static final JLabel pine4 = new JLabel("Pine Tree Planter ($25.99): ");
           public static final JTextField fresh4 = new JTextField(50);
           public static final JPanel panelproduct = new JPanel();
           public static final JPanel panel = new JPanel();
            
           public static final JButton enter = new JButton("Enter");
           
    }

    We can't get it to run as an applet S:

    Is there something we're using that just doesn't work that way?

  6. #6
    diafnaoplzkthnxbai NeoTifa's Avatar
    Join Date
    Jun 2005
    Location
    in psy's panties <3
    Posts
    3,411

    Default

    Why pine? XD What IDE are you using?
    Oh gods, why? ಥ_ಥ


  7. #7
    Last Exile Baloki's Avatar
    Join Date
    Sep 2003
    Location
    Dreaming a dream~
    Posts
    8,425
    Articles
    5
    Blog Entries
    2

    FFXIV Character

    Baloki Kyuu (Sargatanas)
    Contributions
    • Former Senior Site Staff

    Default

    I remember once there was a way of doing it via Active-X, drawback is it's then browser dependent, but it's been so long since I touched Java I can't really remember much useful :/
    FOA

  8. #8
    Recognized Member Jessweeee♪'s Avatar
    Join Date
    Jul 2005
    Location
    i'm on a sandbar help
    Posts
    19,881
    Blog Entries
    12

    FFXIV Character

    Sarangerel Qha (Twintania)
    Contributions
    • Former Cid's Knight
    • Former Site Staff

    Default

    Oh, it's like, selling pine scented air fresheners. The fake company we were "working" for during that particular assignment sells them. So we've turned it in and I don't know if they ever figured it out or not, but it's really bugging me and now I just want to know xD

  9. #9
    i n v i s i b l e Tech Admin o_O's Avatar
    Join Date
    Jun 2001
    Location
    New Zealand
    Posts
    2,957
    Blog Entries
    1

    FFXIV Character

    Humphrey Squibbles (Sargatanas)

    Default

    The structure of the MakingBank class is all wrong - it's been written as a regular standalone Java application. It'll run by itself, but as soon as you try to run it as an applet the Java VM doesn't know what to do with it. Here's a few things that need to change:

    - Currently the class declares only a main() method. Applets should declare the init(), start(), stop() and destroy() methods. init() is called when the applet is loaded and start() is called when it first becomes visible (after init()).
    - Also, an ActionListener is used in the main() method of the class, but it doesn't implement the ActionListener interface in the class definition. You'd need to have your class definition as "public class MakingBank extends JApplet implements ActionListener" if you are going to want it to do anything dynamically.
    - If you are wanting to be able to click on stuff then you probably should include the MouseListener interface as well: "public class MakingBank extends JApplet implements ActionListener,MouseListener"
    - Implementing ActionListener and MouseListener also means you'll have to declare the associated methods for each interface. For ActionListener it's actionPerformed() and for MouseListener they are mouseClicked(), mouseEntered(), mouseExited(), mousePressed(), mouseReleased().
    - I'm assuming that the developer of this code has written a helper class "PressButton", because it doesn't seem to exist in any official APIs.

    Hopefully that helps whoever it needs to - the whole program needs quite an overhaul!

  10. #10
    Recognized Member Jessweeee♪'s Avatar
    Join Date
    Jul 2005
    Location
    i'm on a sandbar help
    Posts
    19,881
    Blog Entries
    12

    FFXIV Character

    Sarangerel Qha (Twintania)
    Contributions
    • Former Cid's Knight
    • Former Site Staff

    Default

    Yeah, we're all newbs xD

    This should help, thanks Face :</>D!

  11. #11
    diafnaoplzkthnxbai NeoTifa's Avatar
    Join Date
    Jun 2005
    Location
    in psy's panties <3
    Posts
    3,411

    Default

    I knew it looked funny, but I really didn't feel like looking through it. Yea, there is no main method, just init(). Have you read any books on java?
    Oh gods, why? ಥ_ಥ


  12. #12
    Recognized Member Jessweeee♪'s Avatar
    Join Date
    Jul 2005
    Location
    i'm on a sandbar help
    Posts
    19,881
    Blog Entries
    12

    FFXIV Character

    Sarangerel Qha (Twintania)
    Contributions
    • Former Cid's Knight
    • Former Site Staff

    Default

    We have textbooks, but I don't understand any of it x.x

  13. #13
    diafnaoplzkthnxbai NeoTifa's Avatar
    Join Date
    Jun 2005
    Location
    in psy's panties <3
    Posts
    3,411

    Default

    Go to the website in my userbar. They have tons of tutorials for this kind of thing. ^___________^
    Oh gods, why? ಥ_ಥ


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •