-
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #80 from bellshade/Dean
feat: Menambahkan program baru
- Loading branch information
Showing
1 changed file
with
23 additions
and
0 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
learn/advanced/Java-GUI/Swing/JPanel-with-JButton/JButtonJPanel.java
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,23 @@ | ||
import javax.swing.*; | ||
|
||
public class JButtonJPanel { | ||
public static void main(String[] args) { | ||
SwingUtilities.invokeLater(new Runnable() { | ||
@Override | ||
public void run() { | ||
createAndShowGUI(); | ||
} | ||
}); | ||
} | ||
private static void createAndShowGUI() { | ||
JFrame frame = new JFrame("Ini adalah JFrame"); | ||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | ||
frame.setBounds(20, 30, 300, 100); | ||
frame.setLayout(null); | ||
|
||
JButton button = new JButton("Click Me"); | ||
frame.getContentPane().add(button); | ||
button.setBounds(20,20,200,20); | ||
frame.setVisible(true); | ||
} | ||
} |