Mise à jour de 'src/JsonInspector/Frame.java'
This commit is contained in:
parent
bec8c0fa06
commit
0ccdd70536
@ -1,99 +1,101 @@
|
|||||||
import javax.swing.*;
|
package JsonInspector;
|
||||||
import java.awt.*;
|
|
||||||
import java.net.MalformedURLException;
|
import javax.swing.*;
|
||||||
import java.net.URL;
|
import java.awt.*;
|
||||||
|
import java.net.MalformedURLException;
|
||||||
public class Frame extends JFrame {
|
import java.net.URL;
|
||||||
private static final Dimension DEFAULT_FRAME_SIZE = new Dimension(800, 600);
|
|
||||||
private static final Dimension MINIMUM_FRAME_SIZE = new Dimension(600, 500);
|
public class Frame extends JFrame {
|
||||||
private static final String DEFAULT_LINK = "https://gbfs.citibikenyc.com/gbfs/en/station_information.json";
|
private static final Dimension DEFAULT_FRAME_SIZE = new Dimension(800, 600);
|
||||||
private final CardLayout cards = new CardLayout();
|
private static final Dimension MINIMUM_FRAME_SIZE = new Dimension(600, 500);
|
||||||
private Node node;
|
private static final String DEFAULT_LINK = "https://gbfs.citibikenyc.com/gbfs/en/station_information.json";
|
||||||
|
private final CardLayout cards = new CardLayout();
|
||||||
public Frame() {
|
private Node node;
|
||||||
super("Inspecteur JSON");
|
|
||||||
init();
|
public Frame() {
|
||||||
this.setVisible(true);
|
super("Inspecteur JSON");
|
||||||
}
|
init();
|
||||||
|
this.setVisible(true);
|
||||||
public Frame(Node node) {
|
}
|
||||||
super("Inspecteur JSON");
|
|
||||||
this.node = node;
|
public Frame(Node node) {
|
||||||
init();
|
super("Inspecteur JSON");
|
||||||
this.add(secondCard());
|
this.node = node;
|
||||||
cards.last(this.getContentPane());
|
init();
|
||||||
this.setVisible(true);
|
this.add(secondCard());
|
||||||
}
|
cards.last(this.getContentPane());
|
||||||
|
this.setVisible(true);
|
||||||
private void init() {
|
}
|
||||||
this.setSize(DEFAULT_FRAME_SIZE);
|
|
||||||
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
|
private void init() {
|
||||||
this.setMinimumSize(MINIMUM_FRAME_SIZE);
|
this.setSize(DEFAULT_FRAME_SIZE);
|
||||||
this.setLayout(cards);
|
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
|
||||||
this.add(firstCard());
|
this.setMinimumSize(MINIMUM_FRAME_SIZE);
|
||||||
//this.add(secondCard());
|
this.setLayout(cards);
|
||||||
cards.first(this.getContentPane());
|
this.add(firstCard());
|
||||||
}
|
//this.add(secondCard());
|
||||||
|
cards.first(this.getContentPane());
|
||||||
private JPanel firstCard() {
|
}
|
||||||
GridBagLayout layout = new GridBagLayout();
|
|
||||||
GridBagConstraints gbc = new GridBagConstraints();
|
private JPanel firstCard() {
|
||||||
JTextField textField = new JTextField(DEFAULT_LINK, 30);
|
GridBagLayout layout = new GridBagLayout();
|
||||||
JButton button = new JButton("Valider");
|
GridBagConstraints gbc = new GridBagConstraints();
|
||||||
button.addActionListener((event) -> validationAction(textField));
|
JTextField textField = new JTextField(DEFAULT_LINK, 30);
|
||||||
JPanel panel = new JPanel();
|
JButton button = new JButton("Valider");
|
||||||
panel.setLayout(layout);
|
button.addActionListener((event) -> validationAction(textField));
|
||||||
|
JPanel panel = new JPanel();
|
||||||
gbc.insets = new Insets(10, 10, 10, 10);
|
panel.setLayout(layout);
|
||||||
gbc.gridx = 0;
|
|
||||||
gbc.gridy = 0;
|
gbc.insets = new Insets(10, 10, 10, 10);
|
||||||
JLabel label = new JLabel("URL :");
|
gbc.gridx = 0;
|
||||||
label.setForeground(Parameters.DEFAULT_TEXT_COLOR);
|
gbc.gridy = 0;
|
||||||
panel.add(label, gbc);
|
JLabel label = new JLabel("URL :");
|
||||||
|
label.setForeground(Parameters.DEFAULT_TEXT_COLOR);
|
||||||
gbc.gridx = 1;
|
panel.add(label, gbc);
|
||||||
panel.add(textField, gbc);
|
|
||||||
|
gbc.gridx = 1;
|
||||||
gbc.gridy = 1;
|
panel.add(textField, gbc);
|
||||||
panel.add(button, gbc);
|
|
||||||
|
gbc.gridy = 1;
|
||||||
panel.setBackground(Parameters.IHM_COLOR);
|
panel.add(button, gbc);
|
||||||
return panel;
|
|
||||||
}
|
panel.setBackground(Parameters.IHM_COLOR);
|
||||||
|
return panel;
|
||||||
private JPanel secondCard() {
|
}
|
||||||
JPanel mainPanel = new JPanel(), southPanel = new JPanel();
|
|
||||||
JButton backButton = new JButton("Retour");
|
private JPanel secondCard() {
|
||||||
backButton.addActionListener((event) -> backAction(mainPanel));
|
JPanel mainPanel = new JPanel(), southPanel = new JPanel();
|
||||||
GraphicFile file = new GraphicFile(new Tree(""));
|
JButton backButton = new JButton("Retour");
|
||||||
JScrollPane scroll = new JScrollPane();
|
backButton.addActionListener((event) -> backAction(mainPanel));
|
||||||
mainPanel.setLayout(new BorderLayout());
|
GraphicFile file = new GraphicFile(new Tree(""));
|
||||||
|
JScrollPane scroll = new JScrollPane();
|
||||||
southPanel.setBackground(Parameters.IHM_COLOR);
|
mainPanel.setLayout(new BorderLayout());
|
||||||
southPanel.add(backButton);
|
|
||||||
southPanel.add(new JButton("Tout déplier"));
|
southPanel.setBackground(Parameters.IHM_COLOR);
|
||||||
southPanel.add(new JButton("convertir en PHP"));
|
southPanel.add(backButton);
|
||||||
|
southPanel.add(new JButton("Tout déplier"));
|
||||||
mainPanel.add(file, BorderLayout.CENTER);
|
southPanel.add(new JButton("convertir en PHP"));
|
||||||
mainPanel.add(southPanel, BorderLayout.SOUTH);
|
|
||||||
mainPanel.add(scroll);
|
mainPanel.add(file, BorderLayout.CENTER);
|
||||||
|
mainPanel.add(southPanel, BorderLayout.SOUTH);
|
||||||
scroll.setViewportView(file);
|
mainPanel.add(scroll);
|
||||||
return mainPanel;
|
|
||||||
}
|
scroll.setViewportView(file);
|
||||||
|
return mainPanel;
|
||||||
private void validationAction(JTextField field) {
|
}
|
||||||
try {
|
|
||||||
URL url = new URL(field.getText());
|
private void validationAction(JTextField field) {
|
||||||
this.add(secondCard());
|
try {
|
||||||
cards.last(this.getContentPane());
|
URL url = new URL(field.getText());
|
||||||
} catch (MalformedURLException e) {
|
this.add(secondCard());
|
||||||
JOptionPane.showMessageDialog(this, "Invalid URL", "Error", JOptionPane.ERROR_MESSAGE);
|
cards.last(this.getContentPane());
|
||||||
}
|
} catch (MalformedURLException e) {
|
||||||
}
|
JOptionPane.showMessageDialog(this, "Invalid URL", "Error", JOptionPane.ERROR_MESSAGE);
|
||||||
|
}
|
||||||
private void backAction(JPanel panel) {
|
}
|
||||||
this.remove(panel);
|
|
||||||
cards.first(this.getContentPane());
|
private void backAction(JPanel panel) {
|
||||||
}
|
this.remove(panel);
|
||||||
}
|
cards.first(this.getContentPane());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user