Advertisement
Grela

Untitled

Oct 11th, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.50 KB | None | 0 0
  1. package Futbol;
  2.  
  3. import java.awt.EventQueue;
  4.  
  5. import javax.swing.JFrame;
  6. import java.awt.GridBagLayout;
  7. import java.awt.BorderLayout;
  8. import javax.swing.JPanel;
  9. import javax.swing.JLabel;
  10. import java.awt.GridBagConstraints;
  11. import javax.swing.JComboBox;
  12. import java.awt.Insets;
  13. import java.net.MalformedURLException;
  14. import java.net.URL;
  15. import java.util.ArrayList;
  16.  
  17. import javax.swing.JSlider;
  18. import javax.swing.JTable;
  19. import javax.swing.JScrollPane;
  20.  
  21. public class Principal {
  22.  
  23.     private JFrame frame;
  24.     private JTable resultsTable;
  25.     private JSlider weekSlider;
  26.     private JComboBox<String> leagueComboBox;
  27.     private JComboBox<String> countryComboBox;
  28.  
  29.     /**
  30.      * Launch the application.
  31.      */
  32.     public static void main(String[] args) {
  33.         EventQueue.invokeLater(new Runnable() {
  34.             public void run() {
  35.                 try {
  36.                     Principal window = new Principal();
  37.                     window.frame.setVisible(true);
  38.                 } catch (Exception e) {
  39.                     e.printStackTrace();
  40.                 }
  41.             }
  42.         });
  43.     }
  44.  
  45.     /**
  46.      * Create the application.
  47.      */
  48.     public Principal() {
  49.         initialize();
  50.     }
  51.  
  52.     /**
  53.      * Initialize the contents of the frame.
  54.      */
  55.     private void initialize() {
  56.         frame = new JFrame();
  57.         frame.setBounds(100, 100, 540, 358);
  58.         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  59.         frame.getContentPane().setLayout(new BorderLayout(0, 0));
  60.        
  61.         JPanel panel = new JPanel();
  62.         frame.getContentPane().add(panel, BorderLayout.CENTER);
  63.         GridBagLayout gbl_panel = new GridBagLayout();
  64.         gbl_panel.columnWidths = new int[]{72, 0, 0};
  65.         gbl_panel.rowHeights = new int[]{0, 0, 0, 0, 0};
  66.         gbl_panel.columnWeights = new double[]{0.0, 1.0, Double.MIN_VALUE};
  67.         gbl_panel.rowWeights = new double[]{0.0, 0.0, 0.0, 1.0, Double.MIN_VALUE};
  68.         panel.setLayout(gbl_panel);
  69.        
  70.         JLabel lblCountry = new JLabel("Country");
  71.         GridBagConstraints gbc_lblCountry = new GridBagConstraints();
  72.         gbc_lblCountry.anchor = GridBagConstraints.EAST;
  73.         gbc_lblCountry.insets = new Insets(0, 0, 5, 5);
  74.         gbc_lblCountry.gridx = 0;
  75.         gbc_lblCountry.gridy = 0;
  76.         panel.add(lblCountry, gbc_lblCountry);
  77.        
  78.         countryComboBox = new JComboBox<String>();
  79.         GridBagConstraints gbc_countryComboBox = new GridBagConstraints();
  80.         gbc_countryComboBox.insets = new Insets(0, 0, 5, 0);
  81.         gbc_countryComboBox.fill = GridBagConstraints.HORIZONTAL;
  82.         gbc_countryComboBox.gridx = 1;
  83.         gbc_countryComboBox.gridy = 0;
  84.         panel.add(countryComboBox, gbc_countryComboBox);
  85.        
  86.         JLabel lblLeague = new JLabel("League");
  87.         GridBagConstraints gbc_lblLeague = new GridBagConstraints();
  88.         gbc_lblLeague.anchor = GridBagConstraints.EAST;
  89.         gbc_lblLeague.insets = new Insets(0, 0, 5, 5);
  90.         gbc_lblLeague.gridx = 0;
  91.         gbc_lblLeague.gridy = 1;
  92.         panel.add(lblLeague, gbc_lblLeague);
  93.        
  94.         leagueComboBox = new JComboBox<String>();
  95.         GridBagConstraints gbc_leagueComboBox = new GridBagConstraints();
  96.         gbc_leagueComboBox.insets = new Insets(0, 0, 5, 0);
  97.         gbc_leagueComboBox.fill = GridBagConstraints.HORIZONTAL;
  98.         gbc_leagueComboBox.gridx = 1;
  99.         gbc_leagueComboBox.gridy = 1;
  100.         panel.add(leagueComboBox, gbc_leagueComboBox);
  101.        
  102.         JLabel jornada = new JLabel("Week");
  103.         GridBagConstraints gbc_jornada = new GridBagConstraints();
  104.         gbc_jornada.anchor = GridBagConstraints.EAST;
  105.         gbc_jornada.insets = new Insets(0, 0, 5, 5);
  106.         gbc_jornada.gridx = 0;
  107.         gbc_jornada.gridy = 2;
  108.         panel.add(jornada, gbc_jornada);
  109.        
  110.         weekSlider = new JSlider();
  111.         GridBagConstraints gbc_weekSlider = new GridBagConstraints();
  112.         gbc_weekSlider.insets = new Insets(0, 0, 5, 0);
  113.         gbc_weekSlider.gridx = 1;
  114.         gbc_weekSlider.gridy = 2;
  115.         panel.add(weekSlider, gbc_weekSlider);
  116.        
  117.         JScrollPane scrollPane = new JScrollPane();
  118.         GridBagConstraints gbc_scrollPane = new GridBagConstraints();
  119.         gbc_scrollPane.gridwidth = 2;
  120.         gbc_scrollPane.insets = new Insets(0, 0, 0, 5);
  121.         gbc_scrollPane.fill = GridBagConstraints.BOTH;
  122.         gbc_scrollPane.gridx = 0;
  123.         gbc_scrollPane.gridy = 3;
  124.         panel.add(scrollPane, gbc_scrollPane);
  125.        
  126.         resultsTable = new JTable();
  127.         scrollPane.setViewportView(resultsTable);
  128.     }
  129.  
  130.     public JSlider getWeekSlider() {
  131.         return weekSlider;
  132.     }
  133.     public JComboBox<String> getLeagueComboBox() {
  134.         return leagueComboBox;
  135.     }
  136.     public JComboBox<String> getCountryComboBox() {
  137.         return countryComboBox;
  138.     }
  139.     private String readURL(String urlRoute){
  140.         try {
  141.             URL url = new URL(urlRoute);
  142.            
  143.         } catch (MalformedURLException e) {
  144.             // TODO Auto-generated catch block
  145.             e.printStackTrace();
  146.         }
  147.         return null;
  148.     }
  149.     private ArrayList<League> extractLeagues(String xml){
  150.         return null;
  151.     }
  152. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement