Example #1
0
  /**
   * Specifies the menu bar value.
   *
   * @deprecated As of Swing version 1.0.3 replaced by <code>setJMenuBar(JMenuBar menu)</code>.
   * @param menu the <code>JMenuBar</code> to add.
   */
  @Deprecated
  public void setMenuBar(JMenuBar menu) {
    if (menuBar != null && menuBar.getParent() == layeredPane) layeredPane.remove(menuBar);
    menuBar = menu;

    if (menuBar != null) layeredPane.add(menuBar, JLayeredPane.FRAME_CONTENT_LAYER);
  }
Example #2
0
  /**
   * Sets the content pane -- the container that holds the components parented by the root pane.
   *
   * <p>Swing's painting architecture requires an opaque <code>JComponent</code> in the containment
   * hierarchy. This is typically provided by the content pane. If you replace the content pane it
   * is recommended you replace it with an opaque <code>JComponent</code>.
   *
   * @param content the <code>Container</code> to use for component-contents
   * @exception java.awt.IllegalComponentStateException (a runtime exception) if the content pane
   *     parameter is <code>null</code>
   */
  public void setContentPane(Container content) {
    if (content == null)
      throw new IllegalComponentStateException("contentPane cannot be set to null.");
    if (contentPane != null && contentPane.getParent() == layeredPane)
      layeredPane.remove(contentPane);
    contentPane = content;

    layeredPane.add(contentPane, JLayeredPane.FRAME_CONTENT_LAYER);
  }
  /**
   * Sets the window title pane -- the JComponent used to provide a plaf a way to override the
   * native operating system's window title pane with one whose look and feel are controlled by the
   * plaf. The plaf creates and sets this value; the default is null, implying a native operating
   * system window title pane.
   *
   * @param content the <code>JComponent</code> to use for the window title pane.
   */
  private void setTitlePane(JRootPane root, JComponent titlePane) {
    JLayeredPane layeredPane = root.getLayeredPane();
    JComponent oldTitlePane = getTitlePane();

    if (oldTitlePane != null) {
      oldTitlePane.setVisible(false);
      layeredPane.remove(oldTitlePane);
    }
    if (titlePane != null) {
      layeredPane.add(titlePane, JLayeredPane.FRAME_CONTENT_LAYER);
      titlePane.setVisible(true);
    }
    this.titlePane = titlePane;
  }
  public Principal() {
    setResizable(false);
    setForeground(UIManager.getColor("CheckBoxMenuItem.selectionBackground"));
    setFont(new Font("Andalus", 1, 12));
    setTitle("CEREAIS PEGER LTDA - EMISSOR DE RECIBO");
    setIconImage(
        Toolkit.getDefaultToolkit()
            .getImage("img\\Super Collection\\Applications\\Script Editor.png"));
    setDefaultCloseOperation(0);
    setBounds(100, 100, 566, 497);
    JPanel contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(new BorderLayout(0, 0));
    JLayeredPane layeredPane = new JLayeredPane();
    layeredPane.setBorder(
        new CompoundBorder(
            new LineBorder(new Color(0, 0, 0), 3), new BevelBorder(1, null, null, null, null)));
    contentPane.add(layeredPane, "Center");
    JButton btEmiteRecibo = new JButton("Emitir Recibo");
    btEmiteRecibo.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent arg0) {
            new Recibo().setVisible(true);
          }
        });
    btEmiteRecibo.setIcon(new ImageIcon("img\\PNG-48\\Modify.png"));
    btEmiteRecibo.setFont(new Font("Tahoma", 1, 12));
    btEmiteRecibo.setBackground(UIManager.getColor("Button.focus"));
    btEmiteRecibo.setBounds(74, 212, 181, 56);
    layeredPane.add(btEmiteRecibo);
    JButton btRelatorio = new JButton("Relatórios");
    btRelatorio.setIcon(new ImageIcon("img\\PNG-48\\Load.png"));
    btRelatorio.setFont(new Font("Tahoma", 1, 12));
    btRelatorio.setBackground(SystemColor.inactiveCaptionBorder);
    btRelatorio.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            new Relatorios().setVisible(true);
          }
        });
    btRelatorio.setBounds(74, 279, 181, 56);
    layeredPane.add(btRelatorio);
    JButton btInfo = new JButton("Informações");
    btInfo.setIcon(new ImageIcon("img\\PNG-48\\Info.png"));
    btInfo.setFont(new Font("Tahoma", 1, 12));
    btInfo.setBackground(SystemColor.inactiveCaptionBorder);
    btInfo.setBounds(304, 279, 181, 56);
    layeredPane.add(btInfo);
    btInfo.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent arg0) {
            (new Informacoes()).setVisible(true);
          }
        });
    JButton btSair = new JButton("Sair");
    btSair.setIcon(new ImageIcon("img\\PNG-32\\Exit.png"));
    btSair.setFont(new Font("Tahoma", 1, 13));
    btSair.setBackground(SystemColor.controlShadow);
    btSair.setBounds(379, 368, 106, 41);
    layeredPane.add(btSair);
    btSair.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent arg0) {
            if (JOptionPane.showConfirmDialog(
                    null, "Deseja Encerrar o programa?", "ATENÇÃO !!! ", 0)
                == 0) System.exit(EXIT_ON_CLOSE);
          }
        });
    JButton btfornecedores = new JButton("Fornecedores");
    btfornecedores.setIcon(new ImageIcon("img\\PNG-48\\Profile.png"));
    btfornecedores.setFont(new Font("Tahoma", 1, 12));
    btfornecedores.setBackground(SystemColor.inactiveCaptionBorder);
    btfornecedores.setBounds(304, 212, 181, 56);
    layeredPane.add(btfornecedores);
    btfornecedores.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent arg0) {
            new CrudFornecedores().setVisible(true);
          }
        });
    JPanel panelRecibo = new JPanel();
    panelRecibo.setForeground(UIManager.getColor("Button.disabledShadow"));
    panelRecibo.setBackground(UIManager.getColor("CheckBoxMenuItem.foreground"));
    panelRecibo.setBorder(UIManager.getBorder("DesktopIcon.border"));
    panelRecibo.setBounds(10, 11, 530, 77);
    layeredPane.add(panelRecibo);
    JLabel LabelRecibo = new JLabel("Emissor de Recibo Eletrônico");
    LabelRecibo.setForeground(UIManager.getColor("Button.background"));
    LabelRecibo.setHorizontalAlignment(2);
    LabelRecibo.setIcon(new ImageIcon("img\\PNG-48\\Modify.png"));
    LabelRecibo.setFont(new Font("Tahoma", 3, 18));
    panelRecibo.add(LabelRecibo);
    JPanel panel = new JPanel();
    panel.setBackground(UIManager.getColor("CheckBox.foreground"));
    panel.setBounds(45, 420, 457, 26);
    layeredPane.add(panel);
    JLabel lblAnthonyTailerCopy = new JLabel(" Anthony Tailer Copyright © ");
    lblAnthonyTailerCopy.setForeground(UIManager.getColor("Button.background"));
    panel.add(lblAnthonyTailerCopy);
    JLabel lblNewLabel = new JLabel("");
    lblNewLabel.setIcon(new ImageIcon("img\\LOGO PEGER 2.png"));
    lblNewLabel.setBounds(165, 99, 234, 88);
    layeredPane.add(lblNewLabel);
  }