import java.awt.*; import javax.swing.*; import java.util.*; import java.sql.*; public class Administrador { public static void createAndShowGUI(String RUT) { try { int ancho = 700; int alto = 550; dataBase data = new dataBase(); data.getPersonalData(RUT); data.getFilesData(RUT); //Make sure we have nice window decorations. JFrame.setDefaultLookAndFeelDecorated(true); //Create and set up the window. JFrame frame = new JFrame("ADMINISTRADOR"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Creacion del content pane a ser utlizado JPanel contentPane = new JPanel(); contentPane.setOpaque(true); contentPane.setLayout(new BorderLayout()); //Agregar los distintos panes al content pane del frame principal. JSplitPane splitH = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new objectivePane(data.getDiagnosticFile(),data.getTreatmentFile(),data.getCommentaryFile()), new subjectivePane()); splitH.setOneTouchExpandable(true); splitH.setDividerLocation(ancho/2); JSplitPane splitV = new JSplitPane(JSplitPane.VERTICAL_SPLIT, new personalPane(data.getName(),data.getRut1(),data.getRut2(),data.getNacimientoD(),data.getNacimientoM(),data.getNacimientoA(),data.getAddress(),data.getCity(),data.getFono1(),data.getFono2(),data.getPrevision()), splitH); splitV.setDividerLocation(175); contentPane.add(splitV); //Create and set up the content pane. frame.setContentPane(contentPane); frame.setJMenuBar(new MenuBar(frame)); //Display the window. frame.setSize(ancho, alto); frame.setLocation(0,0); frame.setVisible(true); } catch (Exception e) { System.out.println("ERROR I/O ja ajja"); System.out.println(e.toString()); } } // Constructor por defecto public static void createAndShowGUI() { try { JFrame newframe = new JFrame("ADMINISTRADOR"); String s = (String)JOptionPane.showInputDialog( newframe, "Ingrese nuevo RUT:\n", "Abrir", JOptionPane.INFORMATION_MESSAGE, null,null,null); Administrador nuevaVentana = new Administrador(); nuevaVentana.createAndShowGUI(s); } catch (Exception e) { System.out.println("ERROR I/O ja aj ja"); System.out.println(e.toString()); } } public static void main(String[] args) { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); // ocupa el constructor por defecto } }); } }