-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
56 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module type="JAVA_MODULE" version="4"> | ||
<component name="NewModuleRootManager"> | ||
<output url="file://$MODULE_DIR$/out/production/" /> | ||
<output-test url="file://$MODULE_DIR$/../out/test/28-Panels" /> | ||
<exclude-output /> | ||
<content url="file://$MODULE_DIR$"> | ||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> | ||
</content> | ||
<orderEntry type="inheritedJdk" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
</component> | ||
</module> |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import javax.swing.*; | ||
import java.awt.*; | ||
|
||
public class Main { | ||
public static void main(String[] args) { | ||
|
||
//JPanel - a GUI component that functions as a container to hold other components | ||
|
||
ImageIcon icon = new ImageIcon("ThumbsUp.png"); | ||
|
||
JLabel label = new JLabel(); | ||
label.setText("Hello"); | ||
label.setIcon(icon); | ||
label.setVerticalAlignment(JLabel.BOTTOM); | ||
label.setHorizontalAlignment(JLabel.RIGHT); | ||
|
||
JPanel redPanel = new JPanel(); | ||
redPanel.setBackground(Color.red); | ||
redPanel.setBounds(0, 0, 250, 250); | ||
|
||
JPanel bluePanel = new JPanel(); | ||
bluePanel.setBackground(Color.blue); | ||
bluePanel.setBounds(250, 0, 250, 250); | ||
|
||
JPanel greenPanel = new JPanel(); | ||
greenPanel.setBackground(Color.green); | ||
greenPanel.setBounds(0, 250, 500, 250); | ||
greenPanel.setLayout(new BorderLayout()); | ||
|
||
JFrame frame = new JFrame(); | ||
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); | ||
frame.setLayout(null); | ||
frame.setSize(750, 750); | ||
frame.setVisible(true); | ||
greenPanel.add(label); | ||
frame.add(redPanel); | ||
frame.add(bluePanel); | ||
frame.add(greenPanel); | ||
|
||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.