1 4 package cve.core.elementEEL; 5 6 import cve.core.comunicazione.*; 7 import cve.core.elementLDL.*; 8 9 import java.util.*; 10 11 import javax.swing.text.*; 12 import javax.swing.*; 13 import javax.swing.event.*; 14 15 import java.awt.*; 16 import java.awt.event.*; 17 import java.util.*; 18 19 import java.awt.event.ComponentEvent .*; 20 21 31 public class Presenter extends ABaseObject { 32 33 36 private JInternalFrame frame; 37 38 41 protected int height=500, width=750; 42 43 46 protected int x=10, y=10; 47 48 52 private JPanel panel; 53 54 57 private CveToolBar toolBar=null; 58 59 62 private Osservatore refOss; 63 64 67 private String pathImage; 68 69 70 71 72 73 74 78 public Presenter () { 79 frame=new JInternalFrame(" View cve environment", 80 true, true, true, true); setLF(); 86 panel=new JPanel(); 87 panel.setLayout(new BorderLayout()); 88 panel.setBackground(Color.white); 89 90 } 91 92 97 public void setSizeP(int alt,int larg) { 98 height=alt; 99 width=larg; 100 } 101 102 106 public void setTitle(String title) { 107 frame.setTitle(title); 108 } 109 110 114 public String getTitle() { 115 return frame.getTitle(); 116 } 117 118 119 124 public void setLocationP(int x,int y) { 125 this.x=x; 126 this.y=y; 127 } 128 129 133 public void setMenu(CveMenuBar menu){ 134 frame.setJMenuBar(menu); 135 } 137 138 144 public JInternalFrame visualizza(){ 145 JPanel panelO=refOss.getPanel(); 146 panel.add(panelO); 147 if (toolBar!=null) 148 panel.add(toolBar,BorderLayout.SOUTH); 149 frame.getContentPane().add(panel); 150 frame.pack(); 151 frame.setLocation(x,y); 152 frame.setSize(new Dimension(width,height)); 153 frame.setVisible(true); 154 return frame; 155 } 156 157 160 public Osservatore getOsservatore(){ 161 return refOss; 162 } 163 164 168 public void setOsservatore(Osservatore refOss){ 169 this.refOss=refOss; 170 } 172 173 177 public void setToolBar(CveToolBar cveTB){ 178 toolBar=cveTB; 179 } 181 182 186 public void setPanel(Container containerOss){ 187 panel.add(containerOss); 188 } 189 190 193 public void refreshPre (){ 194 panel.repaint(); 195 panel.updateUI(); 196 197 frame.repaint(); 198 frame.setVisible(true); 199 } 200 201 205 public void setIcon(String pathImage){ 206 frame.setFrameIcon(new ImageIcon(pathImage)); 207 } 208 209 210 211 212 215 private void setLF() { 216 217 String laf = UIManager.getCrossPlatformLookAndFeelClassName(); 219 try { 220 UIManager.setLookAndFeel(laf); 221 } catch (UnsupportedLookAndFeelException exc) { 222 System.err.println("Warning: UnsupportedLookAndFeel: " + laf); 223 } catch (Exception e) { 224 System.out.println("Errore Caricamento Look&Feel"); 225 } 226 } 227 228 } 229 230 | Popular Tags |