Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (788)
Games in Android Showcase (234)
games submitted by our members
Games in WIP (861)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Problems with JButtons  (Read 2235 times)
0 Members and 1 Guest are viewing this topic.
Offline straydoginc

Junior Devvie

« Posted 2005-09-30 21:30:42 »

Okay here is a good one

My applet has a background.. and when i put my Jbutton on the applet.. I dont see it when the applet is first started. But after mousing over it i see it.

Any reason why this should be happening.
Offline Jeff

JGO Coder

Got any cats?

« Reply #1 - Posted 2005-10-01 03:31:31 »

Most likely you arent calling repaint after adding the button.

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!
Offline straydoginc

Junior Devvie

« Reply #2 - Posted 2005-10-03 18:32:10 »

Hmm. I moved the lines where I actually size and position the buttons to my main Paint Method and that solved the On Load issue.

The problem Im having now is that when i click on one of the buttons my jbuttons dissapear and I have mouse over them again.

*clicking on the button runs an action event method that repaints the screen.

Any thoughts on this
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline cborders

Junior Devvie

« Reply #3 - Posted 2005-10-03 18:59:54 »

Did you override the paint() method and the call repaint from the action event?
Offline g666

Junior Devvie

« Reply #4 - Posted 2005-10-03 19:16:45 »

try using a Button instead of a JButton

desperately seeking sanity
Offline straydoginc

Junior Devvie

« Reply #5 - Posted 2005-10-03 21:05:49 »

Going back to buttons did work. How do i set an icon or graphic for the button? or is this only accomplished with a JButton.
Offline CaptainJester

JGO Knight

Medals: 12
Projects: 2
Exp: 14 years

Make it work; make it better.

« Reply #6 - Posted 2005-10-05 02:44:03 »

If you are using JApplet, you need to override paintComponent(), not paint(), to draw a background image.  You also have to call super.paintComponent()

Pages: [1]
  ignore  |  Print  

hadezbladez (2129 views)
2018-11-16 13:46:03

hadezbladez (809 views)
2018-11-16 13:41:33

hadezbladez (2102 views)
2018-11-16 13:35:35

hadezbladez (419 views)
2018-11-16 13:32:03

EgonOlsen (3453 views)
2018-06-10 19:43:48

EgonOlsen (3680 views)
2018-06-10 19:43:44

EgonOlsen (2275 views)
2018-06-10 19:43:20

DesertCoockie (3004 views)
2018-05-13 18:23:11

nelsongames (3076 views)
2018-04-24 18:15:36

nelsongames (3853 views)
2018-04-24 18:14:32
Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!