import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.beans.*; import java.util.ArrayList; import java.awt.geom.*; import java.awt.Font; /** * Clase JEPdividedPanel * Clase principal de Java Event Programming que permite generar los paneles * divididos y menus que componen la aplicacion. * @author Patricio A. Castillo Pizarro - Eric C. Maldonado Olguin * @version 1.8 - Jun 26th, 2007 */ public class JEPdividedPanel extends JPanel implements ActionListener { private JSplitPane splitPane; private EditorPanel panel; public String texto; public JTextArea textA1; public JTextArea textA2; // public Inicio inicio; private ArrayList font; private String hola; public JEPdividedPanel() { super(new BorderLayout(10,10)); //inicio = new Inicio (200, 100,"Inicio", "Comienza el programa:\n"); //panel.incorpore(inicio); textA1 = new JTextArea(1, 20); textA1.setEditable(false); textA2 = new JTextArea(5, 20); textA2.setEditable(true); panel = new EditorPanel(textA1, textA2); textA1.setText(hola); JScrollPane scrollPane = new JScrollPane(textA1, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); JScrollPane scrollPane2 = new JScrollPane(textA2, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); JPanel panel3= new JPanel(); MenuLateralYsuperior demo = new MenuLateralYsuperior(); JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, demo.createMenuBar(panel,textA1,textA2),PanelHorizontal(panel,PanelVertical(scrollPane,scrollPane2))); splitPane.setResizeWeight(0.006); splitPane.setOneTouchExpandable(true); splitPane.setContinuousLayout(true); JTextField textField = new JTextField(20); add(demo.createControlPanel(panel,textA1,textA2),BorderLayout.BEFORE_FIRST_LINE); add(splitPane, BorderLayout.CENTER); } public JSplitPane PanelHorizontal(EditorPanel sd1,JSplitPane sd2){ JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,sd1,sd2); splitPane.setResizeWeight(0.9); splitPane.setOneTouchExpandable(true); splitPane.setContinuousLayout(true); return splitPane; } public JSplitPane PanelHorizontal2(JTextArea sd1,JTextArea sd2){ JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,sd1,sd2); splitPane.setResizeWeight(0.9); splitPane.setOneTouchExpandable(true); splitPane.setContinuousLayout(true); return splitPane; } public JSplitPane PanelVertical(JScrollPane sd1,JScrollPane sd2){ JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,sd1,sd2); splitPane.setResizeWeight(0.5); splitPane.setOneTouchExpandable(true); splitPane.setContinuousLayout(true); return splitPane; } public void actionPerformed(ActionEvent e) { splitPane.resetToPreferredSizes(); } private static void createAndShowGUI() { EditorFrame frame = new EditorFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } public static void main(String[] args) { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); } public void setTextArea(String name){ texto = name; repaint(); } } //Fin clase JEPdividedPanel