Search Results

Search found 2 results on 1 pages for 'trinth'.

Page 1/1 | 1 

  • Drawing graphics on top of a JButton

    - by trinth
    I have a situation wherein I have a bunch of JButtons on a GridLayout. I need each of the JButtons to have: a background image (but retain the ability to keep the default button look if needed) custom graphics drawn on top by other classes I have no trouble with the background image, since I am using setIcon() but I am having problems drawing things on top of the background. At one point I was able to draw on top of the button, but after the button was clicked, the drawings disappeared. How can make the button keep this drawing state? Basically, I need a way for my JButtons to have public methods that would allow another class to draw anything on it such as: public void drawSomething() { Graphics g = this.getGraphics(); g.drawOval(3,2,2,2); repaint(); } or public Graphics getGraphics() { return this.getGraphics(); } then another class could do this: button.getGraphics().drawSomething(); The latter is more what I am looking for but the first is equally useful. Is there any way to go about this? Also, overriding the parent class method paintComponent() doesn't help since I need each button to have different graphics.

    Read the article

  • Jython: Is there any difference between adding to sys.path vs passing -D?

    - by trinth
    I have a python application that is trying to load some Java libraries (specifically Axis2 web services). When I add the necessary jars in Eclipse via PyDev Project Source Folders, everything seems to work fine. However, I want to be able to do this at run time by adding to sys.path, but then my application doesn't seem to work. In both cases I can load the jars just fine, but something must be different for there to be different results. My question is, is there a difference between adding jars via the sys.path at run time with sys.path.append() versus passing -D to the jython interpreter?

    Read the article

1