1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376
|
/**
*
*/
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.ComponentOrientation;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Insets;
import java.awt.Paint;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.event.MouseListener;
import java.beans.EventHandler;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JPanel;
import com.jam.commons.*;
import com.jam.views.ManagerPane;
import com.jam.views.ToolBarPane;
/**
* @author jamila
*
*/
public class SyndicatMain extends JFrame{
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* @param args
*/
private JPanel mainPane = null;
private ManagerPane managerPane = null;
private ToolBarPane toolBarPane = null;
private JMenu info = null;
private JMenu file = null;
private JMenu resident = null;
private JMenu transaction = null;
private JMenu assembly = null;
private JMenu rent = null;
private JMenu financial = null;
private JMenu maintenance = null;
private JMenu historic = null;
private JMenu report = null;
private JMenu configuration = null;
private JMenuBar mainMenuBar = null;
/**
* This method initializes
*
*/
public SyndicatMain() {
super();
initialize();
//com.sun.awt.AWTUtilities.setWindowOpacity(this,0.9f);
}
/**
* This method initializes this
*
*/
private void initialize() {
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
setSize(dim.width/2 + 400 ,dim.height/2 + 250);
setLocation(dim.width/2 - getWidth()/2, dim.height/2 - getHeight()/2);
setContentPane(getMainPane());
setBackground(new Color(252, 252, 252));
setJMenuBar(getMainMenuBar());
setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
setTitle("Gestion du Syndicat");
}
/**
* This method initializes mainPanel
*
* @return javax.swing.JPanel
*/
private JPanel getMainPane() {
if (mainPane == null) {
mainPane = new JPanel();
mainPane.setSize(this.getWidth(), this.getHeight());
mainPane.setLayout(new BorderLayout());
mainPane.add(getToolBarPane(), BorderLayout.NORTH);
mainPane.add(getManagerPane(), BorderLayout.CENTER);
}
return mainPane;
}
/**
* This method initializes managerPane
*
* @return javax.swing.JPanel
*/
public ManagerPane getManagerPane() {
if (managerPane == null) {
managerPane = new ManagerPane();
managerPane.setSize(mainPane.getWidth(), mainPane.getHeight()- 50);
}
return managerPane;
}
/**
* This method initializes managerPane
*
* @return javax.swing.JPanel
*/
private ToolBarPane getToolBarPane() {
if (toolBarPane == null) {
toolBarPane = new ToolBarPane(this.getWidth(), 50, getManagerPane().getContainerPane());
// lorsque je dois instancier toolBarPane je vais faire appel à une instance de ContainerPane
}
return toolBarPane;
}
/**
* This method initializes file
*
* @return javax.swing.JMenu
*/
private JMenu getFile() {
if (file == null) {
file = new JMenu("file");
file.setText("Fichier");
file.setFont(new Font("Calibri", Font.PLAIN, 13));
}
return file;
}
/**
* This method initializes file
*
* @return javax.swing.JMenu
*/
private JMenu getInfo() {
if (info == null) {
info = new JMenu("info");
info.setText("Info");
info.setFont(new Font("Calibri", Font.PLAIN, 13));
}
return info;
}
/**
* This method initializes Resident
*
* @return javax.swing.JMenu
*/
private JMenu getResident() {
if (resident == null) {
resident = new JMenu("resident");
resident.setText("Résidents");
resident.setFont(new Font("Calibri", Font.PLAIN, 13));
}
return resident;
}
/**
* This method initializes Assembly
*
* @return javax.swing.JMenu
*/
private JMenu getAssembly() {
if (assembly == null) {
assembly = new JMenu("assembly");
assembly.setText("Assemblé");
assembly.setFont(new Font("Calibri", Font.PLAIN, 13));
}
return assembly;
}
/**
* This method initializes Transaction
*
* @return javax.swing.JMenu
*/
private JMenu getTransaction() {
if (transaction == null) {
transaction = new JMenu("transaction");
transaction.setText("Transactions");
transaction.setFont(new Font("Calibri", Font.PLAIN, 13));
}
return transaction;
}
/**
* This method initializes rent
*
* @return javax.swing.JMenu
*/
private JMenu getRent() {
if (rent == null) {
rent = new JMenu("rent");
rent.setText("Location");
rent.setFont(new Font("Calibri", Font.PLAIN, 13));
}
return rent;
}
/**
* This method initializes Maintenance
*
* @return javax.swing.JMenu
*/
private JMenu getMaintenance() {
if (maintenance == null) {
maintenance = new JMenu("maintenance");
maintenance.setText("Maintenance");
maintenance.setFont(new Font("Calibri", Font.PLAIN, 13));
}
return maintenance;
}
/**
* This method initializes Financial state
*
* @return javax.swing.JMenu
*/
private JMenu getFinancial() {
if (financial == null) {
financial = new JMenu("fianacial");
financial.setText("États Financiers");
financial.setFont(new Font("Calibri", Font.PLAIN, 13));
}
return financial;
}
/**
* This method initializes historic
*
* @return javax.swing.JMenu
*/
private JMenu getHistoric() {
if (historic == null) {
historic = new JMenu("historic");
historic.setText("Historique");
historic.setFont(new Font("Calibri", Font.PLAIN, 13));
}
return historic;
}
/**
* This method initializes reports
*
* @return javax.swing.JMenu
*/
private JMenu getReport() {
if (report == null) {
report = new JMenu("report");
report.setText("Rapports");
report.setFont(new Font("Calibri", Font.PLAIN, 13));
}
return report;
}
/**
* This method initializes configuration
*
* @return javax.swing.JMenu
*/
private JMenu getConfiguration() {
if (configuration == null) {
configuration = new JMenu("configuration");
configuration.setText("Configuration");
configuration.setFont(new Font("Calibri", Font.PLAIN, 13));
}
return configuration;
}
/**
* This method initializes mainMenuBar1
*
* @return javax.swing.JMenuBar
*/
private JMenuBar getMainMenuBar() {
if (mainMenuBar == null) {
mainMenuBar = new JMenuBarTemp();
mainMenuBar.setMargin(new Insets(10,5,10,5));
mainMenuBar.setForeground(new Color(188, 207, 243));
mainMenuBar.add(getFile());
mainMenuBar.add(getInfo());
mainMenuBar.add(getAssembly());
mainMenuBar.add(getResident());
mainMenuBar.add(getRent());
mainMenuBar.add(getTransaction());
mainMenuBar.add(getFinancial());
mainMenuBar.add(getMaintenance());
mainMenuBar.add(getHistoric());
mainMenuBar.add(getReport());
mainMenuBar.add(getConfiguration());
}
return mainMenuBar;
}
public static void main(String[] args) {
SyndicatMain sm = new SyndicatMain();
sm.setVisible(true);
}
} // @jve:decl-index=0:visual-constraint="10,10"
class JMenuBarTemp extends JMenuBar{
private Image photoFr ;
private Image photoEn;
private Image photoTn;
private Image helpIcon = null;
public JMenuBarTemp() {
super();
}
/**
* This method initializes helpItem
*
* @return javax.swing.JPanel
*/
private Image getHelpItem() {
if (helpIcon == null) {
helpIcon = getToolkit().getImage("assets/help.png");
}
return helpIcon;
}
/*
*
* This method have to be changed to reduce the number of codeline's
*
*/
protected void paintComponent(Graphics g){
super.paintComponents(g);
photoFr = getToolkit().getImage("assets/fr.jpg");
photoEn = getToolkit().getImage("assets/en.jpg");
photoTn = getToolkit().getImage("assets/tn.jpg");
Rectangle bounds = getBounds();
Graphics2D _g = (Graphics2D) g;
Paint gradientPaint = new GradientPaint(0, bounds.y, new Color(252, 252, 252), 0, bounds.y + bounds.width,
new Color(197 , 204, 204));
_g.setPaint(gradientPaint);
//g.fillRect(0, 0, this.getWidth() - 66, this.getHeight());
g.fillRoundRect(0, 0, this.getWidth(), this.getHeight(), 5, 5);
g.drawImage(photoFr, this.getWidth() - 22, 4, this);
g.drawImage(photoEn, this.getWidth() - 43, 4, this);
g.drawImage(photoTn, this.getWidth() - 64, 4, this);
g.drawImage(getHelpItem(), this.getX()+ 765, 0, this);
}
} |
Partager