Creation des dialogs
This commit is contained in:
67
src/ovh/alexisdelhaie/curling/windows/MainWindow.java
Normal file
67
src/ovh/alexisdelhaie/curling/windows/MainWindow.java
Normal file
@@ -0,0 +1,67 @@
|
||||
package ovh.alexisdelhaie.curling.windows;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class MainWindow extends JDialog {
|
||||
|
||||
private DefaultListModel<String> model;
|
||||
|
||||
private JPanel contentPane;
|
||||
private JTextField textField1;
|
||||
private JTextArea textArea1;
|
||||
private JComboBox comboBox1;
|
||||
private JComboBox comboBox2;
|
||||
private JButton xFormEncodedButton;
|
||||
private JTextArea bodyArea;
|
||||
private JProgressBar progressBar1;
|
||||
private JList list1;
|
||||
private JButton newHeaderButton;
|
||||
private JButton addAuthButton;
|
||||
private JButton runButton;
|
||||
|
||||
public static int WINDOW_HEIGHT = 700;
|
||||
public static int WINDOW_WIDTH = 1100;
|
||||
public static String WINDOW_TITLE = "cURLing";
|
||||
|
||||
public MainWindow() {
|
||||
super((Dialog) null);
|
||||
setTitle(WINDOW_TITLE);
|
||||
model = new DefaultListModel<>();
|
||||
list1.setModel(model);
|
||||
setContentPane(contentPane);
|
||||
setMinimumSize(new Dimension(WINDOW_WIDTH, WINDOW_HEIGHT));
|
||||
setSize(WINDOW_WIDTH, WINDOW_HEIGHT);
|
||||
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||
|
||||
newHeaderButton.addActionListener((event) -> {
|
||||
AddHeader ah = new AddHeader();
|
||||
String header = ah.getValue();
|
||||
model.addElement(header);
|
||||
list1.updateUI();
|
||||
});
|
||||
|
||||
addAuthButton.addActionListener((event) -> {
|
||||
if(addAuthButton.isEnabled()) {
|
||||
BasicAuthenticationDialog bad = new BasicAuthenticationDialog();
|
||||
String auth = bad.showDialog();
|
||||
if(!auth.isBlank()) {
|
||||
addAuthButton.setEnabled(false);
|
||||
model.addElement(auth);
|
||||
list1.updateUI();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
xFormEncodedButton.addActionListener((event) -> {
|
||||
FormEncodedDialog fe = new FormEncodedDialog();
|
||||
String datas = fe.showDialog();
|
||||
bodyArea.setText(datas);
|
||||
});
|
||||
}
|
||||
|
||||
public void showFrame() {
|
||||
pack();
|
||||
setVisible(true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user