Results 1 to 3 of 3
  1. #1
    viosDeveloper is offline Member
    Join Date
    Oct 2012
    Posts
    3
    Rep Power
    0

    Default 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:
    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();
      }
    }
    its supposed to have a black border wrapped around it, but it wont work. why is that?

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is online now Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,453
    Rep Power
    20

    Default Re: virtual iphone code help

    Quote Originally Posted by viosDeveloper View Post
    its supposed to have a black border wrapped around it
    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.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    viosDeveloper is offline Member
    Join Date
    Oct 2012
    Posts
    3
    Rep Power
    0

Similar Threads

  1. When converting code into an iPhone app...
    By Gio D. in forum New To Java
    Replies: 0
    Last Post: 03-16-2010, 08:36 PM
  2. [Virtual KeyBoard] - Anybody know ?
    By Matheus Leandro Ferreira in forum Advanced Java
    Replies: 1
    Last Post: 09-30-2009, 09:22 PM
  3. Virtual table?
    By kblackwell in forum New To Java
    Replies: 4
    Last Post: 01-31-2009, 11:54 PM
  4. Too many virtual Machine
    By davantmay in forum Java Applets
    Replies: 1
    Last Post: 07-06-2007, 11:53 PM
  5. Virtual Machine To Pda
    By Heather in forum Advanced Java
    Replies: 2
    Last Post: 06-30-2007, 04:11 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •