Need some urgent help with my (simple) Applet!

Hello, I'm pretty new to Java and I am beginning to like it!
I'm still verry much new to the language, but if you can help me you make me verry happy!
Oke so I made an Applet where if you push on the button Omhoog, Omlaag, Links, Rechts, and Reset the ball (created with g.Oval in the methode paint) the ball should move above, down, left, right, and with reset it should go to the specified beginningpoint. The thing which I can't get to work is that when you push for instance on rechts(right) I want it to change in color for each specific movement (i.e left right...) and turn to black again when pushing on the reset button. I have been meshing around with if and else but I don't seem to know how to set this proparly. (I hope you can help me out!)
this is my sourcecode:
package oefening80;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class Applet1 extends Applet {
int xPos = 130, yPos = 130;
Button Omhoog, Omlaag, Links, Rechts, Reset;
boolean geklikt, gekliktL;
public void init() {
setBackground( Color.yellow );
setLayout( null );
geklikt = false;
Omhoog = new Button( "Omhoog" );
Omhoog.addActionListener( new OmhoogHandler() );
Omhoog.setBounds( 120, 20, 50, 20 );
gekliktL = false;
Omlaag = new Button( "Omlaag" );
Omlaag.addActionListener( new OmlaagHandler() );
Omlaag.setBounds( 120, 60, 50, 20 );
Reset = new Button( "Reset" );
Reset.addActionListener( new ResetHandler() );
Reset.setBounds( 120, 40, 50, 20);
Links = new Button( "Links" );
Links.addActionListener( new LinksHandler() );
Links.setBounds(70, 40, 50, 20 );
Rechts = new Button( "Rechts" );
Rechts.addActionListener( new RechtsHandler() );
Rechts.setBounds( 170, 40, 50, 20 );
add( Omhoog );
add( Omlaag );
add( Reset );
add( Links );
add( Rechts );
public void paint( Graphics g ) {
g.fillOval( xPos, yPos, 30, 30 );
class OmhoogHandler implements ActionListener {
public void actionPerformed( ActionEvent e ) {
yPos -= 10;
repaint();
class OmlaagHandler implements ActionListener {
public void actionPerformed( ActionEvent e ) {
gekliktL = true;
yPos += 10;
repaint();
class ResetHandler implements ActionListener {
public void actionPerformed( ActionEvent e ) {
xPos = 130;
yPos = 130;
repaint();
class LinksHandler implements ActionListener {
public void actionPerformed( ActionEvent e ) {
xPos -= 10;
repaint();
class RechtsHandler implements ActionListener {
public void actionPerformed( ActionEvent e ) {
xPos += 10;
repaint();
thanks.

Gotten tag.
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class Applet1 extends Applet
     int     xPos = 130, yPos = 130;
     Button  Omhoog, Omlaag, Links, Rechts, Reset;
     boolean geklikt, gekliktL;
public void init()
     setBackground( Color.yellow );
     setLayout( null );
     ActionListener actl = new OHandler();
     geklikt = false;
     Omhoog = new Button("Omhoog");
     Omhoog.addActionListener(actl);
     Omhoog.setBounds(115, 20, 60, 20 );
     gekliktL = false;
     Omlaag = new Button("Omlaag");
     Omlaag.addActionListener(actl);
     Omlaag.setBounds(115, 60, 60, 20 );
     Reset = new Button("Reset");
     Reset.addActionListener(actl);
     Reset.setBounds(120, 40, 50, 20);
     Links = new Button("Links");
     Links.addActionListener(actl);
     Links.setBounds(70, 40, 50, 20 );
     Rechts = new Button("Rechts");
     Rechts.addActionListener(actl);     
     Rechts.setBounds(170, 40, 50, 20 );
     add(Omhoog);
     add(Omlaag);
     add(Reset);
     add(Links);
     add(Rechts);
public void paint(Graphics g)
     super.paint(g);
     g.fillOval(xPos, yPos, 30, 30 );
class OHandler implements ActionListener
public void actionPerformed(ActionEvent e)
     Object obj = e.getSource();
     if (obj.equals(Omhoog)) yPos -= 10;
     if (obj.equals(Omlaag)) yPos += 10;
     if (obj.equals(Rechts)) xPos += 10;
     if (obj.equals(Links))  xPos -= 10;
     if (obj.equals(Reset)) 
          xPos = 130;
          yPos = 130;
     repaint();
[/code
Noah                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • Need some URGENT help with 3 DVD mastering issues PLEASE! :

    Hi there,
    Firstly, I am running DVD SP 3.0.2 on Mac OS 10.4.7 on a G5 Dual 2 GHz 3Gb Ram plenty of HD space...
    I am creating a DVD with: An intro sequence, a main menu, 4 sub menus, and 4 sections with around 12 chapters each.
    I am having some big problems, and a pretty stuck. I will lest them separately below, numbered. If you are able to help, please refer clearly to which number you are helping with. Any help is MUCH appreciated! Many thanks!!
    1. Each of the 5 menus (1 main, 4 sub) have a background video, and a separate audio track. I added the background videos by simply dragging them to the assests panel, then from there onto the menu editor window. They are created in FCP and are properly encoded. However, when I click the motion button, or use the simulator, the videos do not show up. The music plays, but all i see is plain black.
    What is going on?!?!?!
    2. I am really struggling with rollover buttons. I have custom created buttons, and I wand them to have a soft red glow around them when hovered over. HOW ON EARTH DO I ACTUALLY DO THIS??
    The buttons are in photoshop so can be exported with/without background/glow in any format.
    3. Is it possible, once I have got the above rollover working, to have an image to the right hand side of my buttons which changes with the the button rollover. i.e. hover over button 1, see image 1. hover over button 2, image changes to image 2.
    PLEASE PLEASE give any help you can, I have a deadline coming up and am quite stumped. Thanks again!!

    I am still having problems regarding issue Number 1. PLEASE ANYONE HELP?!
    Sorry, I'm not sure about the motion menus. I avoid those whenever possible. But you might click on the menu in the storyline tab (whatever it's called -- the hierarchical view with the disc, tracks, slideshows, etc.) and look at the properties and see if there's anything you have to enable specifically for motion. And be sure the motion button is on on the main display/preview area, but it sounds like you already know how that works.
    For your information, here is a screen grab of the menu I am trying to create:
    http://www.redhavoc.co.uk/stuff/menu.jpg
    I think it is obvious that when a button is hovered over, I want it to glow red, and the image to the right will change to match the respective button.
    IS THIS GOING TO BE POSSIBLE????
    Yes.
    First, your menus have to be layered menus. Unfortunately, there's no way to convert non-layered menus to layered menus, so if you already have non-layered, you'll have to just delete them and create new layered menus. The button (and menu item) to create a layered menu should be right by the normal new-menu item.
    Next, the graphical work is all in Photoshop.
    Side tip: You may already know this, but I found it's best to use 640x480 for the Photoshop document. When I do text and leave it as a text object in the Photoshop file, it resizes poorly in DVDSP. So this ends up being another 720x480 vs. 640x480 square/rectangular pixel conversion thing. DVDSP plays in the 640x480 world, at least as far as the designer can see. So I keep my images at 640x480, and it doesn't have to resize, and everything looks right.
    Moving on... Set up your basic background, the part that won't change (or will have other things covering it, like for your square image).
    Then put in all the buttons and images you'll be using, each part in a separate layer. This could have fifteen buttons (you have five buttons, and there can be three versions for each -- inactive, selected, and activated versions) and five or six square images (you said one for each button, and you might want a blank default if, say, you want to add a "back" button on the menu and want some blank or default image for the square when they're on the "back" button).
    Sometimes people don't bother with a separate "active" button state, but you usually want some visual feedback that they clicked the button. Also, I usually just build the default (unselected) button into the background; that's less hassle later on, and it will just draw the selected or activated buttons over that when the user is on that button.
    Line up all your buttons and images. All the square images lined up perfectly on top of each other, all the buttons in the right places (so you'll have three buttons stacked on top of each other in each spot). Give each layer a short but quickly recognizable name, and line them up in a consistent order. (button1-default, button1-selected, button1-active, button1-squarepicture, then button2-default, ... etc.) Photoshop and DVDSP don't care, but it makes it easier for you later.
    Note that earlier versions of DVDSP won't show Photoshop layer effects. (They handle layers, just not the effects, like inner glow, outer bezel, etc.) I don't remember when they changed this, but I think it was version 4.something. So if you're using that method to make your buttons glow, you may have to flatten each selected or active button layer, and you may even need to create a dummy blank layer underneath it first to give it something to flatten onto.
    Save the file as a standard Photoshop file (.psd). Drag the file onto your DVDSP layered menu and set it as the background.
    Now, in DVDSP, create all your buttons. Just drag boxes over/around the button pictures you have. Feel free to make them extra-big; users won't see the actual area you've selected, and bigger areas makes it easier for people to hit them if they're using a mouse on a computer to watch the DVD. You can point the buttons to their targets now if you want, and set the end jumps on the tracks if you want. (I tend to set the end jumps on the tracks so they automatically select the button for the next track.)
    Now's the fun part, since it will actually hook everything up and should be easy if your naming layer order were consistent. Click on the layered menu (in that hierarchical view) and look at the properties window. (Sorry I can't remember the technical names for all these windows; I'm doing this all from memory. So feel free to ask more questions if you can't find what I'm talking about.) One of the properties tabs should have a grid of checkboxes with a list of your layers. Make sure the background is checked for all of the states. Then check the layers you want to show for each button state, as well as the corresponding square image to show for each.
    Again, I'm doing this from memory, and I can't remember exactly how things are listed in that grid. But I remember it keeps your layers in the same order you put them in the Photoshop file and shows you those names, so it should make it easy to go down the list and check the right boxes.
    And another side tip: You can update the Photoshop file, but once you've put it in DVDSP, if you change the layer order, it will screw up the check boxes you checked. It always shows you the layer names correctly, but it keeps the checkboxes in DVDSP simply assigned to the layer number, so the fifth layer will keep the same checkboxes even if you juggle them so some other layer is now the fifth layer. So if you do juggle the layers in Photoshop, go back and fix the checkbox list in DVDSP.
    I put a sample Photoshop file based on yours in
    http://dan.black.org/layered-menu-sample.psd
    It's quick and dirty, but shows the layer layout, and you should be able to drop it on DVDSP to play with. (I also won't leave it there forever, maybe a few weeks, so anybody reading this in a month or more probably will get a 404 for that url.)
    Again, doing this from memory, so feel free to ask if anything doesn't work or doesn't make sense.
    G4/dual867   Mac OS X (10.4.5)   2GB/0.8TB

  • Need some urgent help with Java code...

    Hello
    i am taking a java class..beginner..and i am a dud at programming...
    had a couple of questions ..how do make a program ignore negative
    integer values,make it terminate when zero is entered instead of a number ,how should i calculate maximum minimum of integers..please help me..
    thanks
    damini

    You got some good advice from Java_Jay.
    Here is a snippet I keep handy for console input and output. It doesn't do your home work but gives you a working example of getting numbers from stdin:
    import java.io.*;
    public class DemoKeyboardInput {
         public static void main(String[] args) throws IOException {
              // open keyboard for input (call it 'stdin')
              BufferedReader stdin = new BufferedReader(new InputStreamReader(
                        System.in), 1);
              // get input from the keyboard
              System.out.print("Please enter your name: ");
              String name = stdin.readLine();
              System.out.print("Please enter your age: ");
              String s1 = stdin.readLine();
              System.out.print("Please enter the radius of a circle: ");
              String s2 = stdin.readLine();
              // perform conversions on input strings
              int age = Integer.parseInt(s1); // string to int
              double radius = Double.parseDouble(s2); // string to double
              // operate on data
              age++; // increment age
              double area = Math.PI * radius * radius; // compute circle area
              // output results
              System.out.println("Hello " + name);
              System.out.println("On your next birthday, you will be " + age
                        + " years old");
              System.out.println("Area of circle is " + area);
    }

  • Need some urgent help with ps vita

    My son has a ps vita, and a few days ago, I found some history of visiting adult websites. He claims that these sites just pop up, and he is not purposely seeking out these sites.
    Is it possible for adult sites to pop up on ps vitas?
    Thanks
    IW

    Sony PlayStation has a separate community which can be found here. Please visit the link for best assistance with your PlayStation Vita.
    If my post answers your question, please click on "Accept as Solution"

  • Need some quick help with redoing a website

    Hi, I did my website done in iWeb in 2008, published it, and have it hosted by GoDaddy. I want to take it offline for now and design a new 'under construction' site, but there is a chance that I might want to still go back to the original version.
    I see the current 'Domain' in Home Folder>Library>Application Support>iWeb.
    Can I just redo my site (still working in pre-2008 iWeb), publish it, and if I need to, use the old 'Domain' to revert to my current website?
    If yes, how do I do that....and, if 'no', what should I do?
    Thanks!

    Hi and thanks. To reply....
    I published the website in iWeb and it is on my MobleMe. It was done in iWeb v 1.1.2, and I have not upgraded iLife on the computer that I designed the website on, as I feared losing some/all of it in an upgrade.
    I do, however, pay GoDaddy for my corporate URL AND hosting....which I suspect is the forwarding and not 'hosting' per se....but on my Hosting account on GoDaddy it does say 'Shared Hosting'.
    I do not want to 'overwrite' my current site just yet, as I am uncertain about the next one's content or the time to do it the way I envision it. What I want to do is SAVE my current site in case I want it back and, in the meantime, put up a page that says Under Construction. Can you help with that?
    Much appreciated

  • I need some serious help with MPEG Streamclip and iMovie 11

    Hello, everyone!
    I hope that some kind soul here is able to help me. My sister-in-law asked me if I could help her re-edit a video that they made of a conference she gave because she didn't like the way some parts were edited. I oh-so-kindly (and perhaps stupidly) offered to help her out!
    A little background: even though I studied audiovisual communications in college, I leaned (a LOT) towards the audio production part of it and, lately, photography, too. That means that I'm not very good at the whole creating-a-movie-in-iMovie thing, even though I know it's supposed to be easy.
    So, here goes: I have a DVD from her which has the typical TS files for audio and video. I downloaded a program called MPEG Streamclip and then it said I needed to buy the QuickTime MPEG-2 Playback Component so that I could rip the DVD my sister-in-law gave me. I bought the component.
    I've converted, done small, 1-minute tests, of the DVD with MPEG Streamclip to DV and also to MP4 (just in case). I do it, then import them to iMovie 11. I don't edit anything at all, just a test to see how it looks, so I immediately send the project to iDVD to see how it looks. It DOES NOT look good.
    Compared to the DVD she gave me, which looks all smooth (picture-wise), mine has a certain amount (NOT HUGE) of pixelation. I can tell especially because there are some slides that were added to her project, so I can see the pixelated parts around the edges of the letters.
    The DVD she gave me does NOT look HD. In fact, it looks SD (4:3), so I don't believe it's that.
    If anybody here knows about this, what am I doing wrong? Am I not ripping it correctly using MPEG Streamclip? Am I not making the iMovie 11 project right? Am I burning in the "wrong way"?
    If it's the MPEG Streamclip ripping that I'm doing wrong, what are the settings I should be using? What format should I be using so that it is VERY iMovie-friendly?
    I want the final video that I would edit to look exactly as the one she gave me. That IS possible, right?
    For extra information, if needed, I am running a MacBook Pro, 13", i7 with 4 GB of RAM and am running OS 10.6.6. I've been a Mac user since the OS 9 days.
    Thanks in advance for anyone who helps me out.
    Serge

    Ok. Got it!!!
    Z, thanks a lot!! Now things don't look pixelated and my test burn looks exactly like the dvd my sister-in-law gave me... except for ONE THING:
    There are these graphics done in I-don't-know-what program with a cube transition. They look like when you do 3D cube transitions in virtual desktop, you know?
    Anyway, HER dvd looks completely smooth when you see these transitions but MY dvd looks... well, not right. It looks a bit like the screen or the letters "tremble" or shake a bit. I hope you can understand what I'm saying.
    I followed your advice to the letter and everything is perfect with the exception of those transitions (because after the transition passes and you see the slide with the writing, it looks completely smooth).
    Do you know of something that I can do to help with this problem?
    Thanks again!
    Serge

  • I need some serious help with Oracle Database....PLEASE!!

    I am using Microsoft Virtual PC 2007 that has Oracle Database 10g and Wondows XP installed on it.
    Database instance is DOWN but that is not the problem
    Listener is UP
    Agent Connection to Instance is DOWN, and I cannot get this running!
    How can I fix this problem? I am not an expert, but I have been trying for a long time to fix this issue, but I can't. It just came to the point that I want to grab my pc and throw it across the room.
    Error message: ORA-12505: TNS:listener does not currently know of SID given in connect descriptor (DBD ERROR: OCIServerAttach)
    Here is my LISTENER.ORA file:
    # listener.ora Network Configuration File: C:\oracle\product\10.2.0\db_1\network\admin\listener.ora
    # Generated by Oracle configuration tools.
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = C:\oracle\product\10.2.0\db_1)
    (PROGRAM = extproc)
    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.109)(PORT = 1521))
    Here is my TSNNAME.ORA file:
    # tnsnames.ora Network Configuration File: C:\oracle\product\10.2.0\db_1\network\admin\tnsnames.ora
    # Generated by Oracle configuration tools.
    ORCL =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.109)(PORT = 1521))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = orcl)
    EXTPROC_CONNECTION_DATA =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
    (CONNECT_DATA =
    (SID = PLSExtProc)
    (PRESENTATION = RO)
    Once again, I am not an expert, so please try to explain it as simple as possible...I know, I am an idiot when it comes to networking issues.
    if you guys need some more information, just let me know!
    Thank you!

    What I mean is that I can get the Instance UP with no problem, but the Connection with the Instance is the problem.
    C:\Documents and Settings\Paolo\Desktop\courselabs\labs>lsnrctl service
    LSNRCTL for 32-bit Windows: Version 10.2.0.1.0 - Production on 25-NOV-2009 21:38
    :06
    Copyright (c) 1991, 2005, Oracle. All rights reserved.
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
    Services Summary...
    Service "PLSExtProc" has 1 instance(s).
    Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
    Handler(s):
    "DEDICATED" established:0 refused:0
    LOCAL SERVER
    Service "orcl" has 1 instance(s).
    Instance "orcl", status READY, has 1 handler(s) for this service...
    Handler(s):
    "DEDICATED" established:144 refused:0 state:ready
    LOCAL SERVER
    Service "orclXDB" has 1 instance(s).
    Instance "orcl", status READY, has 1 handler(s) for this service...
    Handler(s):
    "D000" established:0 refused:0 current:0 max:1002 state:ready
    DISPATCHER <machine: PAOLOSCAMARDELL, pid: 2576>
    (ADDRESS=(PROTOCOL=tcp)(HOST=paoloscamardell)(PORT=2307))
    Service "orcl_XPT" has 1 instance(s).
    Instance "orcl", status READY, has 1 handler(s) for this service...
    Handler(s):
    "DEDICATED" established:144 refused:0 state:ready
    LOCAL SERVER
    The command completed successfully
    C:\Documents and Settings\Paolo\Desktop\courselabs\labs>lsnrctl status
    LSNRCTL for 32-bit Windows: Version 10.2.0.1.0 - Production on 25-NOV-2009 21:52
    :03
    Copyright (c) 1991, 2005, Oracle. All rights reserved.
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
    STATUS of the LISTENER
    Alias LISTENER
    Version TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Produ
    ction
    Start Date 25-NOV-2009 11:50:27
    Uptime 0 days 10 hr. 1 min. 39 sec
    Trace Level off
    Security ON: Local OS Authentication
    SNMP OFF
    Listener Parameter File C:\oracle\product\10.2.0\db_1\network\admin\listener.o
    ra
    Listener Log File C:\oracle\product\10.2.0\db_1\network\log\listener.log
    Listening Endpoints Summary...
    (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1ipc)))
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.109)(PORT=1521)))
    Services Summary...
    Service "PLSExtProc" has 1 instance(s).
    Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
    Service "orcl" has 1 instance(s).
    Instance "orcl", status READY, has 1 handler(s) for this service...
    Service "orclXDB" has 1 instance(s).
    Instance "orcl", status READY, has 1 handler(s) for this service...
    Service "orcl_XPT" has 1 instance(s).
    Instance "orcl", status READY, has 1 handler(s) for this service...
    The command completed successfully
    C:\Documents and Settings\Paolo\Desktop\courselabs\labs>

  • I need some urgent Help!

    Ok, i use my ibook (stats below) at my high school, (which has a one to one program, but i use my personal one) which has a DHCP network, so i have always been able to use my personal laptop at school on the internet, however, i got a email that said they were disabling DHCP TOMORROW and that the school laptops had to be switched location or something like that, ANYWAY, i want to use my personal lappy at school, but now that i can't use DHCP, what do i need to do? I'm kind of a networking newb here, if i have to ask the IT guys for an IP address, then i don't think its gonna work, i think they might frown upon me having my personal at school. Please help me!

    I suppose you don't care, but the IT people at your school do care about security issues. Asking us to circumvent their concerns by telling you how to access the school's computer system illegally violates the Terms of Use of the Apple Discussions.
    I suggest you either ask the school's permission to use their system with your computer or go elsewhere for help with your quest.
    This site is the property of Apple Computer. Perhaps you will appreciate the irony of asking them to participate in an illegal activity.

  • Help with a simple Applet

    I am just starting Applets. This code compiles and a blank Applet displays but the Button object does not display. The HTML should be good because the blank Applet displays. Both files are saved in the same directory and my java code is compiled. Help?
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    public class WhosGreat extends Applet implements ActionListener
    Button btnGreat = new Button("Who's the Greatest?");
    Font LargeFnt = new Font("Times Roman",Font.BOLD,10);
    public void init()
    //btnGreat.setFont(LargeFnt);
    add(btnGreat);
    btnGreat.addActionListener(this);
    public void actionPerformed(ActionEvent e)
    String name = "Bugs Bunny";
    Label lblName = new Label("");
    lblName.setFont(LargeFnt);
    lblName.setText(name);
    add(lblName);
    invalidate();
    validate();
    }

    I compiled your code and ran it. It did just what you said in Internet explorer but it worked just fine in Netscape7 and appletviewer.Just remember microsoft sucks:)

  • Need some basic help with applets

    Hey all, I've never made an applet before and I'm having a small problem. Basically, when I load my applet, the GUI comes up on a separate window (doesn't load within the applet window). Here's my code:
    Here's the GUI class.
    import java.awt.BorderLayout;
    import java.io.File;
    import java.util.Vector;
    import javax.swing.DefaultComboBoxModel;
    import javax.swing.DefaultListModel;
    import javax.swing.JButton;
    import javax.swing.JFileChooser;
    import javax.swing.JList;
    import javax.swing.JScrollPane;
    import javax.swing.JTextField;
    import javax.swing.JTextPane;
    import javax.swing.ListModel;
    import javax.swing.WindowConstants;
    import javax.swing.SwingUtilities;
    * This code was edited or generated using CloudGarden's Jigloo
    * SWT/Swing GUI Builder, which is free for non-commercial
    * use. If Jigloo is being used commercially (ie, by a corporation,
    * company or business for any purpose whatever) then you
    * should purchase a license for each developer using Jigloo.
    * Please visit www.cloudgarden.com for details.
    * Use of Jigloo implies acceptance of these licensing terms.
    * A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
    * THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
    * LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
    public class GUI extends javax.swing.JFrame {
              //Set Look & Feel
              try {
                   javax.swing.UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
              } catch(Exception e) {
                   e.printStackTrace();
         private JButton openB;
         private JButton oddsB;
         private JScrollPane jScrollPane1;
         private JList jList1;
         private JTextField fileText;
         private Vector<String> jList1Objects;
         * Auto-generated main method to display this JFrame
         /*public static void main(String[] args) {
              SwingUtilities.invokeLater(new Runnable() {
                   public void run() {
                        GUI inst = new GUI();
                        inst.setLocationRelativeTo(null);
                        inst.setVisible(true);
         public GUI() {
              super();
              initGUI();
         private void initGUI() {
              try {
                   setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
                   getContentPane().setLayout(null);
                        //Text field for file entry
                        fileText = new JTextField();
                        getContentPane().add(fileText);
                        fileText.setBounds(0, 0, 279, 25);
                        //Scroll Pane and jList1
                        jScrollPane1 = new JScrollPane();
                        getContentPane().add(jScrollPane1);
                        jScrollPane1.setBounds(0, 25, 150, 328);
                             jList1Objects = new Vector<String>();
                             jList1 = new JList(jList1Objects);
                             jScrollPane1.setViewportView(jList1);
                        //Open button and Odds button
                        openB = new JButton();
                        oddsB = new JButton();
                        getContentPane().add(oddsB);
                        getContentPane().add(openB);
                        oddsB.setText("Calculate Odds");
                        oddsB.setBounds(679, 109, 105, 353);
                        openB.setText("Open File");
                        openB.setBounds(279, 0, 99, 25);
                        //Open Button action
                        openB.addActionListener(new java.awt.event.ActionListener() {
                             public void actionPerformed(java.awt.event.ActionEvent evt) {
                                  //Opens up hand history file to be read in
                                  JFileChooser fc = new JFileChooser();
                                  fc.setCurrentDirectory(new File("C:\\Program Files\\Full Tilt Poker\\HandHistory"));
                                  int returnVal = fc.showOpenDialog(getContentPane());     
                                  if(returnVal == JFileChooser.APPROVE_OPTION) {
                                       //Display file in text box
                                       fileText.setText(fc.getSelectedFile().toString());
                                       //TODO: Write function to read in file and add all Hands to jList1
                                       //Recompile jList1
                                       jList1Objects = new Vector<String>();
                                       jList1Objects.add(fc.getSelectedFile().toString());
                                       jList1 = new JList(jList1Objects);
                                       jScrollPane1.setViewportView(jList1);
                   pack();
                   setSize(800, 800);
              } catch (Exception e) {
                   e.printStackTrace();
    }Here's the class my HTML file calls:
    import java.applet.Applet;
    import javax.swing.JFrame;
    public class Main extends Applet{
         //Mainframe
         //JFrame f = new JFrame();
         public void init() {
              GUI inst = new GUI();
              inst.setLocationRelativeTo(null);
              inst.setVisible(true);
              //f.setContentPane(inst.getContentPane());
         public void start() {
            System.out.println("Starting...");
      public void stop() {
            System.out.println("Stopping...");
    }

    // <applet code='Main' width='400' height='200' ></applet>
    import javax.swing.*;
    public class Main extends JApplet{
        public void init() {
            GUI inst = new GUI();
            getContentPane().add(inst.getContentPane());
            validate();
        public void start() {
            System.out.println("Starting...");
        public void stop() {
            System.out.println("Stopping...");
    }Other notes:
    - You try to set the PLAF to Windows. which will not work on Linux and Mac (and if it did, the users would be screaming at you).
    - setLayout(null)/setBounds(int,int,int,int) is rubbish GUI development, it is fragile and will cause problems (especially if changing PLAFs)
    - Why did you not code this as a hybrid application/app?
    - The call to the JFileChooser will require a trusted applet, and it is pointing to the wrong place in seeking out the 'Program Files' directory, better to put configuration data/history data in a sub-dir or user.home.
    - This app. is much better suited to being deployed using Java Web Start. Forget the applet and use the frame, persistence can be obtained through the PersistenceService and that will side step both the application needing 'trust' and trying to find a suitable path for storing results of past games. JWS can launch the app. directly off the net, and provides auto-update and many other slick features.

  • I'm new to java and I need some quick help with NetBeans.

    Hi. To whomever can help here's the problem. I've been trying to install netbeans ide 5.0 on my computer for a while now and i can't seem to find out what is wrong. I'm in a java programming course and i need the J2SE Developement Kit 5.0 Update 7 and NetBeans IDE 5.0 Installer on my comp. Whenever i go to install it, it can't automatically create a directory and has erroe null in place of it. Whenever i made a new directory for it a page would come up telling me all of the errors during the installation which are null. Since i have administrator privelages and plenty of free space on my hardrive.

    Hi,
    I want to suggest you that
    1.please check if any prerequisite is require before installing the NetBeans IDE,i hope there is nothing like that except proper jdk on your machine.
    2.if you already having JDK on your machine check for the compatibility of that jdk version with the required NetBeans IDE version.
    3.follow the steps provided to install the NetBeans IDE 5.0 for that refer the below link
    http://www.netbeans.org/community/releases/50/install.html
    hope you will get rid of the problem .....
    ---Vidya

  • Need some urgent help on printing HTML

    I am trying to print an HTML using JEditorPane. I used all the GURU's views in this forum and copied the code. It works fine, but the images or not getting printed correctly
    Here is my HTML:
    <html>
    <head>
    <title>test</title>
    </head>
    <body>
    <h1>HELLO</h1>
    <h2>Hello</h2>
    <h6><big><big><big>This is a Test Program for the print</big></big></big></h6>
    <br>
    <p>
    You can also use an image as a link:
    <img border="0" src="D:\Tips\Projects\edib\logo.gif" width="65" height="38">
    </p>
    <br>
    <IMG SRC="D:\Tips\Projects\edib\logo.gif" width="65" height="38">
    </body>
    </html>
    These two images are not getting printed. My java class, html and logo.gif are all in the same directory.
    Here's the java code which I got it from this forum
    import java.io.*;
    import java.awt.print.*;
    import javax.swing.*;
    public class PrintHTMLSwing extends JFrame
         public static void main(String args[]) throws Exception
         //Read the HTML file to a String.
         FileInputStream fio = new FileInputStream(args[0]);
         int size = fio.available();
         byte[] fl = new byte[size];
         fio.read(fl,0,size);
         System.out.println(new String(fl));
         PrintableEditorPane ep = new PrintableEditorPane();
         ep.setContentType("text/html");
         //System.out.println(ep.getContentType());
         ep.setText(new String(fl));
         PrintHTMLSwing p = new PrintHTMLSwing();
         p.getContentPane().add(ep);
         //p.setSize(100,100);
         p.pack();
         p.show();
         // Get a PrinterJob
         PrinterJob job = PrinterJob.getPrinterJob();
         // Create a landscape page format
         PageFormat landscape = job.defaultPage();
         landscape.setOrientation(PageFormat.LANDSCAPE);
         // Set up a book
         Book bk = new Book();
         bk.append(ep, job.defaultPage());
         // Pass the book to the PrinterJob
         job.setPageable(bk);
         // Put up the dialog box
         if (job.printDialog())
              // Print the job if the user didn't cancel printing
              try
                   job.print();
              catch (Exception e)
                   System.out.println("Error 1:"+ e.toString());
              System.exit(1);
    class PrintableEditorPane extends javax.swing.JEditorPane implements java.awt.print.Printable
         public int print(java.awt.Graphics g, java.awt.print.PageFormat pageFormat, int      pageIndex)
              int x = (int)pageFormat.getImageableX();
              int y = (int)pageFormat.getImageableY();
              g.translate(x, y);
              paint(g);
              return PAGE_EXISTS;
    WILL ANYONE PLS HELP ME WHATS WRONG WITH THE CODE OR WHAT ELSE SHOULD I DO TO GET THE IMAGES TO PRINT CORRECTLY
    Thanks
    Tips

    All u need to do is specify a protocol. In your case it will be "file://"" preceeding the path to the images. Not a very good idea to use absolute path to the images though. Consider relative ones instead.
    Hope this helps.

  • I need some basic help with Email setup

    Hello, I ve just been connected to infinity and I m trying to setup a few email addresses but the BT yahoo system is confusing me.
    I managed to create a new email (sub account) for my wife but I m struggling with finding a way to have a couple more for myself. Do I really need to make a sub account for each email?
    The default email has my name and surname in it which is not something I generally use for that purpose, I would only use that one for close friends and family, I would like to setup another one for general use and one for when there is a likelyhood it ll get a lot of spam.
    The way to add extra emails is usually very simple (with previous isps) , login to "manage my account" and choose username and password then enter the details in outlook express.
    With BT I m having to deal with the Yahoo thingy, which does a lot of more than just emails but at this time I have interest in it at all.
    1 - I would simply like to setup a few emails to use with outlook express, what is the best way to achieve that ?
    2 - The yahoo email seems to be part of a network like facebook, as I  don t intend to use that side of it I would prefer not to have my personal details associated with a profile that I do not  need . It seems to be for public viewing by default.
    Can I set up and use my emails without having an online profile for yahoo?
    How do i keep my details offline (not publicly viewable in yahoo)?
    thanks.

    yes!
    you get one prime email address. the one you agreed to and the one to set up your bt mail, it was in letter confirming bt set up. (order ref)
    for more for yourself, or anybody else,  its got to be sub. up to ten for INF2
    I have set up 4 sub accounts with different names, etc. but use the same password for all 5 .
    I then had them set up with outlook express, there is a bt prog to do this. look on site.
    Then I use incredimail as my final mail client, this also has a prog to set up from outlook express.
    so all my mail to and from me ends up in incredimail with my 4 sub accounts, using one as my prime.
    my bt prime I do not use, as it is my full name.
    so far so good, just a bit slow finding its way, like you my previous ISP (tesco) was less complicated, but slow copper wire.
    good luck
    Ronin22
    In the end we will all be star dust.
    Then start all over again.

  • I need some syntax help with reading some values from a selected row in an Access form.

    My goal:  to extract the data from 4 fields in a datasheet row and place them in another form.
    My problem:  I can only get the field values from the first row of the datasheet.
    I have tried using the Form_Click event as the location for the code I've tried.  This seems to be the right place, but apparently referring to the desired fields by their names with Me. in front just references the first record in the datasheet, not
    the one I've selected.
    Should I just read the source form's recordset using the Currentrecord value somehow?  I could use some direction on that.
    Thank you.
    Marj Weir

    It's generally considered good forum etiquette to post back a description of the solution which you've reached.
    The normal control for a multi-valued field is a combo box rather than a text box, but unless it is necessary for you to use a  multi-valued field, i.e. your database is interfacing with SharePoint in the very limited context in which this feature is necessary,
    I'd advise that you model the many-to-many relationship type in the time-honoured way by means of a table which resolves the relationship type into two one-to-many relationship types, and use a subform to show the data.  You can alternatively use a multi-select
    list box or a text box which shows a value list.  You'll find examples of all three methods in StudentCourses.zip in my public databases folder at:
    https://onedrive.live.com/?cid=44CC60D7FEA42912&id=44CC60D7FEA42912!169
    If you have difficulty opening the link copy its text (NB, not the link location) and paste it into your browser's address bar.
    Ken Sheridan, Stafford, England

  • Offtopic, but i really need some urgent help

    Hey guys,
    I just noticed that ive got a really wasted virus :/
    Its renaming all my files and folders to what lookes like Japanese characters, but because i havnt got a interpreter, they appear as those little block thingies. After its done renaming the folder, it declares it as empty, and when you try to open it, it says something about : "#Folder Path# is not accesible. The file or directory is corrupt and unreachable." Ive been watching it slowly spread, trying to scan and disinfect it with my Anti-Virus (F-Secure), but it wants nothing of the sort, coz it sees the folder as empty and skips the search. Ive already lost WEEKS of dowloaded material (Mostly Anime and music, but irresplacable none the less)
    already, and im about to freak out. Any help would be very very very much appreciated. If you could direct me to a Anti-Virus that you think will solve the problem, that would be really cool. This is really important, im only guessing, but its prolly only a matter of time before it starts attacking my windows folder, then im gonne be in really deep trouble :(

    My Computer is gonne be dead and buried by the time
    this site loads, That is the problem with downloading stuff on a Windows box without having a virus checker or a firewall.
    and this isnt a cheap computer
    either :/ Which will be cheaper? A virus checker or re-installing your oprerating system and downloading all your files again.
    >
    What do you think about removing the infected/useless
    harddrive? Think that might slow the infection down?
    Im open to all sorts of suggestions, as long as the
    are fast acting :/I think you are stuffed!

Maybe you are looking for

  • When I turned off my iPhone 4S, it will always turn on automatically.

    I bought my iPhone 4S last December in USA during my business trip. I use my iPhone 4S in China Shanghai. But during this year February, it can never be turned off. When I turned it off, it will turn on automatically. In China, you must turn your pho

  • Delaying

    Hey, I will try to explain my problem as best as I can without it being too complicated... here goes. Me and a friend have created a new flash website. Now, on the top navigational bar... if you press on one of the buttons to go to a differen't "page

  • Apple TV Power Cord

    I would like to know where I can purchase the electrical Power Cord of the Apple TV that plugs into the power port of the Apple TV\. For some reason the plug that goes into the apple TV is defective

  • Plug-ins for object extraction

    Hello, ImageSkill developed 2 Photoshop-compatible plug-ins for extraction of opaque and translucent objects (fur, smoke, glass, haze, wool etc). Using our products you can make a result that is unavailable with other masking programs - Adobe Magic E

  • Update_conflict_handler

    Hi everyone I need your help.. I have a streams environment in Two Database 10gR2 on Unix. The replication processes working, but I have a problem during execution of this procedure DBMS_APPLY_ADM.SET_UPDATE_CONFLICT_HANDLER... I need to remove a col