Search:

Type: Posts; User: stewbond

Search: Search took 0.17 seconds.

  1. [SOLVED] Re: My MouseInputListener methods aren't being called.

    The component with listeners is "JLabel m_container" which is a member of Canvas and holds an ImageIcon().

    I use these so that when I use the mouse in the container, my methods are called:...
  2. [SOLVED] My MouseInputListener methods aren't being called.

    I have the following class which uses mousePressed, mouseDragged, and mouseReleased. I've thrown some breakpoints in these methods with jdb, but I find that they aren't triggered when I try and...
  3. Replies
    6
    Views
    342

    Re: Repainting an image

    Got it, thanks.

    This is what it looks like now:

    public class ImgPanel extends JPanel {
    JLabel imgLbl;

    public ImgPanel(String initPath) {
    imgLbl = new JLabel(new ImageIcon());
    ...
  4. Replies
    6
    Views
    342

    Re: Repainting an image

    Comming from a C/C++ world, this is the hardest thing for me about Java. I haven't figured out what is a reference and what is a copy. Could you write a line or two of code to explain that?

    I've...
  5. Replies
    6
    Views
    342

    Repainting an image

    I have this class. Upon initialization, I see the image I want, but when I call load() a second or third time, the image doesn't refresh. How can I repaint the image?


    public class ImgPanel...
  6. Thread: Generics

    by stewbond
    Replies
    3
    Views
    181

    [SOLVED] Re: Generics

    That is certainly too bad. Thanks for the response.
  7. Thread: Generics

    by stewbond
    Replies
    3
    Views
    181

    [SOLVED] Generics

    I'm having trouble figuring out how to properly define Generics. Could you let me know what I'm doing wrong here?



    public class MyClass1<T>
    {
    private final MyClass2<T> myobject;
    private...
  8. Replies
    4
    Views
    203

    Re: References versus values

    So if there are no references and everything is a copy, then I'm quite confused regarding how some of my other applications are working.

    Working with GUIs I often do this:

    JButton button = new...
  9. Replies
    4
    Views
    203

    References versus values

    Comming from C here. I'm trying to figure out when I have a copy of an object and when I have a reference to an object. I tried out this function, and the original values are left un-modified. How...
  10. Replies
    2
    Views
    330

    [SOLVED] Re: JFileChooser provides null string

    Whoops! Thanks for the easy fix.

    I was reading about this class here:
    JFileChooser (Java Platform SE 7 )
    I guess I skipped over the getSelectedFile() part of it.
  11. Replies
    2
    Views
    330

    [SOLVED] JFileChooser provides null string

    I'm getting a NullPointerException in my code. I've use the debugger and traced it to the chooser.getName() line. This is returning a null value to me.

    Does anyone have an idea where I went...
  12. Re: Custom JObject (Cross between JTextField and JComboBox)

    Thanks for the responses. It looks I have two completely opposite paths to explorer. I'll try both out and see what happens.
  13. Custom JObject (Cross between JTextField and JComboBox)

    This is my first custom swing object, but I'm not sure where to start. I want to make something similar to a browser's address bar where you can type something. After any character is...
  14. Replies
    5
    Views
    271

    [SOLVED] Re: Animation and double buffering

    Got it,

    In paintComponent() I was still calling super.paint(). Calling super.paintComponent() fixed this.

    Thanks for your awesome help. The program is 100% now.

    --- Update ---

    Total...
  15. Replies
    5
    Views
    271

    [SOLVED] Re: Animation and double buffering

    Ok so I read this article. The only difference that I see between what I did and what they did was that they used paintComponent() instead of paint(). I've tried to over-ride this instead, but now...
  16. Replies
    5
    Views
    271

    [SOLVED] Animation and double buffering

    I have a class for which I am not happy with the animation. I've simplified it to a simple square moving accross the screen. My problem is that the screen doesn't clear and so instead of a moving...
  17. Replies
    3
    Views
    224

    [SOLVED] Re: Managing layout in JFrame

    Interesting, I thought it used FlowLayout by default. I will lookup BorderLayout and figure out how to manipulate it.

    --- Update ---

    Great! Fixed it with:

    this.add( leftPanel ,...
  18. Replies
    3
    Views
    224

    [SOLVED] Managing layout in JFrame

    I have the following class. When I comment out this.add( rightPanel ); leftPanel appears perfectly. When I comment out this.add( leftPanel );, my rightPanel animates perfectly. When I have both, I...
Results 1 to 18 of 18