Results 1 to 3 of 3
Thread: virtual iphone code help
- 10-28-2012, 06:41 AM #1
Member
- Join Date
- Oct 2012
- Posts
- 3
- Rep Power
- 0
virtual iphone code help
Hi everybody! I have done console c++ programming for a year and decided to do gui java (since there both oop). my first project is a virtual iphone, but im having trouble with it. here is my code:
its supposed to have a black border wrapped around it, but it wont work. why is that?Java Code:import java.awt.*; import java.awt.Color; import javax.swing.*; import javax.swing.border.*; public class VirtualIPhone { public VirtualIPhone() { createWindow(); } private static void createWindow() { JFrame frame = new JFrame("Virtual IPhone"); Border lineBdr = BorderFactory.createLineBorder(Color.black, 10); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel textLabel = new JLabel("This is the screen", SwingConstants.CENTER); textLabel.setPreferredSize(new Dimension(260, 510)); Container content = frame.getContentPane(); content.setBackground(Color.white); frame.getContentPane().add(textLabel, BorderLayout.CENTER); frame.setLocation(700, 100); frame.pack(); frame.setVisible(true); } public static void main(String[] args) { VirtualIPhone IPhoneScreen = new VirtualIPhone(); } }
- 10-28-2012, 07:34 AM #2
Re: virtual iphone code help
I don't see any code that might do that.
Better go through the Swing tutorials and learn how to use borders; also go through the section on Concurrency in Swing and learn how to construct and manipulate Swing components on the EDT.
Trail: Creating a GUI With JFC/Swing (The Java™ Tutorials)
Any future questions you have after learning Swing should be posted in the AWT/Swing section.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 10-28-2012, 07:49 AM #3
Member
- Join Date
- Oct 2012
- Posts
- 3
- Rep Power
- 0
Similar Threads
-
When converting code into an iPhone app...
By Gio D. in forum New To JavaReplies: 0Last Post: 03-16-2010, 07:36 PM -
[Virtual KeyBoard] - Anybody know ?
By Matheus Leandro Ferreira in forum Advanced JavaReplies: 1Last Post: 09-30-2009, 08:22 PM -
Virtual table?
By kblackwell in forum New To JavaReplies: 4Last Post: 01-31-2009, 10:54 PM -
Too many virtual Machine
By davantmay in forum Java AppletsReplies: 1Last Post: 07-06-2007, 10:53 PM -
Virtual Machine To Pda
By Heather in forum Advanced JavaReplies: 2Last Post: 06-30-2007, 03:11 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks