Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

liliy Group Title

I need to make a GUI and display the correct time under a clock. How do I center the time Text ?

  • one year ago
  • one year ago

  • This Question is Closed
  1. OttoMan Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    in what programming language?

    • one year ago
  2. liliy Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    java

    • one year ago
  3. OttoMan Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    So you want to create a GUI and show the time, have I understood it right?

    • one year ago
  4. OttoMan Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    Go ahead and create two classes Main and GUI ---Main Class---- import javax.swing.JFrame; public class Main { public static void main(String args[]){ displayGUI(); } public static void displayGUI(){ JFrame window = new JFrame(); window.setTitle("Display Clock"); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.setResizable(false); new GUI(window); } } ---Class Main END---- ---Class GUI--- import java.awt.Container; import javax.swing.RootPaneContainer; public class GUI{ public GUI(RootPaneContainer rpc){ Container cp = rpc.getContentPane(); Container rootWindow = (Container) rpc; cp.setLayout(null); rootWindow.setSize(500,500); rootWindow.setVisible(true); } } ---Class GUI End--- Now you have an empty GUI, one you get this working let me know and we can process onto displaying clock.

    • one year ago
    • Attachments:

See more questions >>>

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.