/* * Copyright (C) 2014 Shashank Tulsyan * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package neembuu.release1.ui.frame; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; import neembuu.release1.ui.frame.JFrameDecorator.ContentArea_add_callback; import neembuu.swing.HiddenBorderButton; /** * * @author Shashank Tulsyan */ public class FrameDecoration extends javax.swing.JPanel { final ContentArea_add_callback ca; /** * Creates new form FrameDecoration */ public FrameDecoration(final ContentArea_add_callback ca) { this.ca = ca; initComponents(); /*addMouseMotionListener(new MLP("frameOutside")); frameBorder.addMouseMotionListener(new MLP("frameBorder")); contentArea.addMouseMotionListener(new MLP("contentArea")); headerRegion.addMouseMotionListener(new MLP("headerRegion"));*/ } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { frameBorder = new javax.swing.JPanel(); contentArea = new javax.swing.JPanel(); headerRegion = new javax.swing.JPanel(); title = new javax.swing.JLabel(); icon = new javax.swing.JLabel(); frameControls = new javax.swing.JPanel(); b1 = HiddenBorderButton.make(this, "/neembuu/release1/ui/images/cross.png", "/neembuu/release1/ui/images/cross_s.png", false); b2 = HiddenBorderButton.make(this, "/neembuu/release1/ui/images/tray.png", "/neembuu/release1/ui/images/tray_s.png", false); b3 = HiddenBorderButton.make(this, "/neembuu/release1/ui/images/dash.png", "/neembuu/release1/ui/images/dash_s.png", false); setBackground(new java.awt.Color(233, 228, 214)); frameBorder.setBackground(new java.awt.Color(255, 255, 251)); contentArea.setBackground(new java.awt.Color(255, 255, 255)); contentArea.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 252, 249))); contentArea.setLayout(new java.awt.BorderLayout()); headerRegion.setBackground(new java.awt.Color(255, 255, 251)); title.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N title.setText(org.openide.util.NbBundle.getMessage(FrameDecoration.class, "FrameDecoration.title.text")); // NOI18N icon.setIcon(new javax.swing.ImageIcon(getClass().getResource("/neembuu/release1/ui/images/7_ls_small_transparent_16x16.png"))); // NOI18N icon.setText(org.openide.util.NbBundle.getMessage(FrameDecoration.class, "FrameDecoration.icon.text")); // NOI18N frameControls.setBackground(new java.awt.Color(255, 255, 251)); b1.setBorderPainted(false); b1.setContentAreaFilled(false); b1.setFocusable(false); b2.setBorderPainted(false); b2.setContentAreaFilled(false); b2.setFocusable(false); b3.setToolTipText(org.openide.util.NbBundle.getMessage(FrameDecoration.class, "FrameDecoration.b3.toolTipText")); // NOI18N b3.setBorderPainted(false); b3.setContentAreaFilled(false); b3.setFocusable(false); javax.swing.GroupLayout frameControlsLayout = new javax.swing.GroupLayout(frameControls); frameControls.setLayout(frameControlsLayout); frameControlsLayout.setHorizontalGroup( frameControlsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, frameControlsLayout.createSequentialGroup() .addComponent(b3, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE) .addComponent(b2, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE) .addComponent(b1, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, 0)) ); frameControlsLayout.setVerticalGroup( frameControlsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, frameControlsLayout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) .addGroup(frameControlsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(b1, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(b2, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(b3, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(0, 0, Short.MAX_VALUE)) ); javax.swing.GroupLayout headerRegionLayout = new javax.swing.GroupLayout(headerRegion); headerRegion.setLayout(headerRegionLayout); headerRegionLayout.setHorizontalGroup( headerRegionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(headerRegionLayout.createSequentialGroup() .addGap(6, 6, 6) .addComponent(icon) .addGap(0, 85, Short.MAX_VALUE) .addComponent(title) .addGap(0, 84, Short.MAX_VALUE) .addComponent(frameControls, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) ); headerRegionLayout.setVerticalGroup( headerRegionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(icon, javax.swing.GroupLayout.DEFAULT_SIZE, 25, Short.MAX_VALUE) .addComponent(title, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(frameControls, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); javax.swing.GroupLayout frameBorderLayout = new javax.swing.GroupLayout(frameBorder); frameBorder.setLayout(frameBorderLayout); frameBorderLayout.setHorizontalGroup( frameBorderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(frameBorderLayout.createSequentialGroup() .addGap(6, 6, 6) .addComponent(contentArea, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(6, 6, 6)) .addComponent(headerRegion, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); frameBorderLayout.setVerticalGroup( frameBorderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(frameBorderLayout.createSequentialGroup() .addGap(0, 0, 0) .addComponent(headerRegion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, 0) .addComponent(contentArea, javax.swing.GroupLayout.DEFAULT_SIZE, 271, Short.MAX_VALUE) .addGap(6, 6, 6)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(3, 3, 3) .addComponent(frameBorder, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(3, 3, 3)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(3, 3, 3) .addComponent(frameBorder, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(3, 3, 3)) ); }// </editor-fold>//GEN-END:initComponents public CustomJFrame getCustomJFrame(){ return new CustomJFrame() { @Override public JButton b1() { return b1;} @Override public JButton b2() { return b2;} @Override public JButton b3() { return b3;} @Override public void contentArea_add(JPanel toAdd) { contentArea.add(toAdd); if(ca!=null)ca.contentArea_add(toAdd);} @Override public JPanel frameBorder() { return frameBorder;} @Override public JPanel frameControls() { return frameControls;} @Override public JPanel headerRegion() { return headerRegion;} @Override public JPanel frameOutside() {return FrameDecoration.this;} @Override public JLabel icon() { return icon;} @Override public JLabel title() { return title;} }; } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton b1; private javax.swing.JButton b2; private javax.swing.JButton b3; private javax.swing.JPanel contentArea; private javax.swing.JPanel frameBorder; private javax.swing.JPanel frameControls; private javax.swing.JPanel headerRegion; private javax.swing.JLabel icon; private javax.swing.JLabel title; // End of variables declaration//GEN-END:variables }