Question

Question 14 1 pts With Java AWT Components when working with the coordinate system, what direction is 0,0 to INF, INF (only t
0 0
Add a comment Improve this question Transcribed image text
Answer #1

1) Bottom Right to Top Right: Let suppose our co-ordinate system is of 400x400 size

import java.awt.BorderLayout;

import java.awt.Color;

import java.awt.Dimension;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JPanel;

public class Main {

public static void main(String[] args) {

JLabel label = new JLabel("Hello");

label.setOpaque(true);

label.setBackground(Color.red);

JPanel bottomPanel = new JPanel(new BorderLayout());

bottomPanel.add(label,BorderLayout.LINE_END);

JPanel mainPanel = new JPanel(new BorderLayout());

mainPanel.add(bottomPanel, BorderLayout.PAGE_END);

mainPanel.setPreferredSize(new Dimension(400,400)); // it is at TOP RIGHT position, so by changing the value of x and y here you can set your container at desire location.

JFrame frame = new JFrame();

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

frame.getContentPane().add(mainPanel);

frame.pack();

frame.setLocationRelativeTo(null);

frame.setVisible(true);

}

}

Add a comment
Know the answer?
Add Answer to:
Question 14 1 pts With Java AWT Components when working with the coordinate system, what direction...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT