Results 1 to 3 of 3
- 01-05-2011, 07:39 PM #1
Member
- Join Date
- Jan 2011
- Posts
- 2
- Rep Power
- 0
How can you get a custom background image for a Jframe +
Hi, my problem is i'm trying to get a custom background for my frame, everything else works with my program and i tried a bunch of different methods but none seem to work. This is the part of my program that displays the first button and i got a custom background color, so can anyone tell me wat i should add.
import javax.swing.*;
import java.awt.*;
import javax.swing.JFrame;
public class ISU{
public static void main(String[] args){
Button1 go = new Button1();
go.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
go.setSize(280,190);
go.getContentPane().setBackground(Color.BLACK);//part i need to change
go.setVisible(true);
}
}
;)
- 01-05-2011, 07:45 PM #2
You just want your JFrame to have a background color? Or are you trying to set the background of the JButton?
"go" is a JButton, so it doesn't have a content pane.How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
- 01-05-2011, 10:19 PM #3
Member
- Join Date
- Jan 2011
- Posts
- 2
- Rep Power
- 0
Similar Threads
-
trying to add image to background in JFrame...what's the problem in this program
By sahildave1991 in forum AWT / SwingReplies: 6Last Post: 07-21-2010, 06:15 AM -
JFrame image background
By 851marc in forum NetBeansReplies: 5Last Post: 03-09-2010, 06:27 PM -
How to add a background image to JFrame
By dunafrothint in forum AWT / SwingReplies: 1Last Post: 02-26-2010, 10:17 PM -
Need help with JFrame background image
By ProGenius in forum New To JavaReplies: 6Last Post: 12-27-2009, 04:17 PM -
GUI... setting my background to an image, im using a JFrame
By newtojava7 in forum New To JavaReplies: 2Last Post: 03-24-2008, 05:29 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks