Skip to content

Improved the GUI by adding an information panel #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .project
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,15 @@
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<filteredResources>
<filter>
<id>1747063860741</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
Binary file modified bin/algo_Calc/Frame$1.class
Binary file not shown.
Binary file modified bin/algo_Calc/Frame$2.class
Binary file not shown.
Binary file modified bin/algo_Calc/Frame$3.class
Binary file not shown.
Binary file modified bin/algo_Calc/Frame$4.class
Binary file not shown.
Binary file modified bin/algo_Calc/Frame$5.class
Binary file not shown.
Binary file modified bin/algo_Calc/Frame$6.class
Binary file not shown.
Binary file removed bin/algo_Calc/Frame$7.class
Binary file not shown.
Binary file modified bin/algo_Calc/Frame.class
Binary file not shown.
Binary file modified bin/algo_Calc/Sortingss$1.class
Binary file not shown.
Binary file modified bin/algo_Calc/Sortingss$2.class
Binary file not shown.
Binary file modified bin/algo_Calc/Sortingss$3.class
Binary file not shown.
Binary file modified bin/algo_Calc/Sortingss$4.class
Binary file not shown.
66 changes: 40 additions & 26 deletions src/algo_Calc/Frame.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
package algo_Calc;
import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JFrame;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class Frame {

Expand All @@ -14,14 +21,12 @@ public class Frame {
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Frame window = new Frame();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
EventQueue.invokeLater(() -> {
try {
Frame window = new Frame();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
});
}
Expand All @@ -38,20 +43,29 @@ public Frame() {
*/
private void initialize() {
Sortingss obj = new Sortingss();
frame = new JFrame();
frame.setBounds(100, 100, 456, 324);
frame = new JFrame("Kalkulator Algoritma Pengurutan");
frame.setBounds(100, 100, 500, 450);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(null);

// Panel untuk judul
JPanel titlePanel = new JPanel();
JLabel titleLabel = new JLabel("KALKULATOR ALGORITMA PENGURUTAN");
titleLabel.setFont(new Font("Arial", Font.BOLD, 18));
titlePanel.add(titleLabel);

// Panel untuk tombol-tombol
JPanel buttonPanel = new JPanel(new GridLayout(3, 2, 20, 20));
buttonPanel.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));

// Tambahkan tombol ke panel
JButton btnNewButton = new JButton("Bubble Sort");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
obj.vis(1,"BUBBLE SORT");
frame.setVisible(false);
}
});
btnNewButton.setBounds(43, 48, 128, 25);
frame.getContentPane().add(btnNewButton);
buttonPanel.add(btnNewButton);

JButton btnNewButton_1 = new JButton("Insertion Sort");
btnNewButton_1.addActionListener(new ActionListener() {
Expand All @@ -60,8 +74,7 @@ public void actionPerformed(ActionEvent e) {
frame.setVisible(false);
}
});
btnNewButton_1.setBounds(253, 48, 128, 25);
frame.getContentPane().add(btnNewButton_1);
buttonPanel.add(btnNewButton_1);

JButton btnNewButton_2 = new JButton("Selection Sort");
btnNewButton_2.addActionListener(new ActionListener() {
Expand All @@ -70,8 +83,7 @@ public void actionPerformed(ActionEvent e) {
frame.setVisible(false);
}
});
btnNewButton_2.setBounds(43, 116, 128, 25);
frame.getContentPane().add(btnNewButton_2);
buttonPanel.add(btnNewButton_2);

JButton btnNewButton_3 = new JButton("Merge Sort");
btnNewButton_3.addActionListener(new ActionListener() {
Expand All @@ -80,8 +92,7 @@ public void actionPerformed(ActionEvent e) {
frame.setVisible(false);
}
});
btnNewButton_3.setBounds(253, 116, 128, 25);
frame.getContentPane().add(btnNewButton_3);
buttonPanel.add(btnNewButton_3);

JButton btnNewButton_4 = new JButton("Quick Sort");
btnNewButton_4.addActionListener(new ActionListener() {
Expand All @@ -90,8 +101,7 @@ public void actionPerformed(ActionEvent e) {
frame.setVisible(false);
}
});
btnNewButton_4.setBounds(43, 178, 128, 25);
frame.getContentPane().add(btnNewButton_4);
buttonPanel.add(btnNewButton_4);

JButton btnNewButton_5 = new JButton("Max Heap Sort");
btnNewButton_5.addActionListener(new ActionListener() {
Expand All @@ -100,7 +110,11 @@ public void actionPerformed(ActionEvent e) {
frame.setVisible(false);
}
});
btnNewButton_5.setBounds(253, 178, 128, 25);
frame.getContentPane().add(btnNewButton_5);
buttonPanel.add(btnNewButton_5);

// Mengatur layout utama
frame.getContentPane().setLayout(new BorderLayout());
frame.getContentPane().add(titlePanel, BorderLayout.NORTH);
frame.getContentPane().add(buttonPanel, BorderLayout.CENTER);
}
}