List of usage examples for javax.swing JMenu setBackground
@BeanProperty(preferred = true, visualUpdate = true, description = "The background color of the component.") public void setBackground(Color bg)
From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.navegacao_cego.PainelSimuladorNavegacao.java
/** * Cria o menu editar do Frame Principal * //from w w w. j a va 2 s .c om * @param menu */ private JMenu criaMenuEditar() { JMenu menu = new JMenu(GERAL.EDITAR); menu.setBackground(parentFrame.corDefault); menu.setMnemonic('E'); menu.setMnemonic(KeyEvent.VK_E); JMenuItem btnContraste = new JMenuItem(GERAL.BTN_ALTERAR_CONTRASTE); btnContraste.addActionListener(this); btnContraste.setActionCommand("Contraste"); // btnAumenta.setMnemonic('F'); // btnAumenta.setMnemonic(KeyEvent.VK_F); // btnAumenta.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ADD, // ActionEvent.CTRL_MASK)); btnContraste.setToolTipText(GERAL.ALTERAR_CONTRASTE); btnContraste.getAccessibleContext().setAccessibleDescription(GERAL.ALTERAR_CONTRASTE); menu.add(btnContraste); JMenuItem btnAumenta = new JMenuItem(GERAL.AUMENTA_FONTE); btnAumenta.addActionListener(this); btnAumenta.setActionCommand("AumentaFonte"); // btnAumenta.setMnemonic('F'); // btnAumenta.setMnemonic(KeyEvent.VK_F); btnAumenta.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ADD, ActionEvent.CTRL_MASK)); btnAumenta.setToolTipText(GERAL.DICA_AUMENTA_FONTE); btnAumenta.getAccessibleContext().setAccessibleDescription(GERAL.DICA_AUMENTA_FONTE); menu.add(btnAumenta); JMenuItem btnDiminui = new JMenuItem(GERAL.DIMINUI_FONTE); btnDiminui.addActionListener(this); btnDiminui.setActionCommand("DiminuiFonte"); // btnDiminui.setMnemonic('F'); // btnDiminui.setMnemonic(KeyEvent.VK_F); btnDiminui.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_SUBTRACT, ActionEvent.CTRL_MASK)); btnDiminui.setToolTipText(GERAL.DICA_DIMINUI_FONTE); btnDiminui.getAccessibleContext().setAccessibleDescription(GERAL.DICA_DIMINUI_FONTE); menu.add(btnDiminui); JMenuItem btnSelecionarTudo = new JMenuItem(GERAL.SELECIONAR_TUDO); btnSelecionarTudo.addActionListener(this); btnSelecionarTudo.setActionCommand("SelecionarTudo"); btnSelecionarTudo.setMnemonic('T'); btnSelecionarTudo.setMnemonic(KeyEvent.VK_T); btnSelecionarTudo.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, ActionEvent.CTRL_MASK)); btnSelecionarTudo.setToolTipText(GERAL.DICA_SELECIONAR_TUDO); btnSelecionarTudo.getAccessibleContext().setAccessibleDescription(GERAL.DICA_SELECIONAR_TUDO); menu.add(btnSelecionarTudo); menu.add(new JSeparator()); /* * JMenuItem btnProcurar = new JMenuItem(GERAL.PROCURAR); * btnProcurar.addActionListener(this); * btnProcurar.setActionCommand("Procurar"); * btnProcurar.setMnemonic('P'); btnProcurar.setMnemonic(KeyEvent.VK_P); * btnProcurar.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F, * ActionEvent.CTRL_MASK)); * btnProcurar.setToolTipText(GERAL.DICA_PROCURAR); * btnProcurar.getAccessibleContext().setAccessibleDescription(GERAL.DICA_PROCURAR); * menu.add(btnProcurar); * * JMenuItem btnSelecionarTudo = new JMenuItem(GERAL.SELECIONAR_TUDO); * btnSelecionarTudo.addActionListener(this); * btnSelecionarTudo.setActionCommand("SelecionarTudo"); * btnSelecionarTudo.setMnemonic('T'); * btnSelecionarTudo.setMnemonic(KeyEvent.VK_T); * btnSelecionarTudo.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, * ActionEvent.CTRL_MASK)); * btnSelecionarTudo.setToolTipText(GERAL.DICA_SELECIONAR_TUDO); * btnSelecionarTudo.getAccessibleContext().setAccessibleDescription(GERAL.DICA_SELECIONAR_TUDO); * menu.add(btnSelecionarTudo); * * JMenuItem btnDesfazer = new JMenuItem(GERAL.DESFAZER); * btnDesfazer.addActionListener(this); * btnDesfazer.setActionCommand("Desfazer"); * btnDesfazer.setMnemonic('z'); btnDesfazer.setMnemonic(KeyEvent.VK_Z); * btnDesfazer.getAccessibleContext().setAccessibleDescription(GERAL.DICA_DESFAZER); * btnDesfazer.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Z, * ActionEvent.CTRL_MASK)); menu.add(btnDesfazer); * menu.setEnabled(true); */ return menu; }
From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.navegacao_cego.PainelSimuladorNavegacao.java
private JMenuBar criaMenuBar() { menuBar = new JMenuBar(); menuBar.setBackground(parentFrame.corDefault); JMenu menuArquivo = new JMenu(GERAL.ARQUIVO); menuArquivo.setMnemonic('A'); menuArquivo.setMnemonic(KeyEvent.VK_A); menuArquivo.setBackground(parentFrame.corDefault); JMenu avaliadores = new JMenu(); MenuSilvinha menuSilvinha = new MenuSilvinha(parentFrame, null); menuSilvinha.criaMenuAvaliadores(avaliadores); // menuArquivo.add(avaliadores); // menuArquivo.add(new JSeparator()); JMenuItem btnAbrir = new JMenuItem(GERAL.BTN_ABRIR); btnAbrir.addActionListener(this); btnAbrir.setActionCommand("Abrir"); btnAbrir.setMnemonic('A'); btnAbrir.setAccelerator(/* w w w . ja va 2 s . c o m*/ javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, ActionEvent.CTRL_MASK)); btnAbrir.setMnemonic(KeyEvent.VK_A); btnAbrir.setToolTipText(TradSimuladorNavegacao.DICA_ABRE_E_AVALIA); btnAbrir.getAccessibleContext().setAccessibleDescription(TradSimuladorNavegacao.DICA_ABRE_E_AVALIA); menuArquivo.add(btnAbrir); JMenuItem btnAbrirUrl = new JMenuItem(XHTML_Panel.BTN_ABRIR_URL); btnAbrirUrl.addActionListener(this); btnAbrirUrl.setActionCommand("AbrirURL"); btnAbrirUrl.setMnemonic('U'); btnAbrirUrl.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_U, ActionEvent.CTRL_MASK)); btnAbrirUrl.setMnemonic(KeyEvent.VK_U); btnAbrirUrl.setToolTipText(XHTML_Panel.DICA_ABRIR); btnAbrirUrl.getAccessibleContext().setAccessibleDescription(XHTML_Panel.DICA_ABRIR); menuArquivo.add(btnAbrirUrl); btnSalvar = new JMenuItem(GERAL.BTN_SALVAR); btnSalvar.addActionListener(this); btnSalvar.setActionCommand("Salvar"); btnSalvar.setMnemonic('S'); btnSalvar.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, ActionEvent.CTRL_MASK)); btnSalvar.setMnemonic(KeyEvent.VK_S); btnSalvar.getAccessibleContext().setAccessibleDescription(TradSimuladorNavegacao.DICA_GRAVA_E_REAVALIA); // menuArquivo.add(btnSalvar); JMenuItem btnSalvarAs = new JMenuItem(GERAL.BTN_SALVAR_COMO); btnSalvarAs.addActionListener(this); btnSalvarAs.setActionCommand("SaveAs"); btnSalvarAs.setMnemonic('c'); btnSalvarAs.setMnemonic(KeyEvent.VK_C); // btnSalvarAs.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, // ActionEvent.CTRL_MASK)); btnSalvarAs.setToolTipText(GERAL.DICA_SALVAR_COMO); btnSalvarAs.getAccessibleContext().setAccessibleDescription(GERAL.DICA_SALVAR_COMO); // menuArquivo.add(btnSalvarAs); menuArquivo.add(new JSeparator()); JMenuItem btnFechar = new JMenuItem(GERAL.SAIR); //btnFechar.addActionListener(this); btnFechar.setActionCommand("Sair"); //btnFechar.setMnemonic(KeyEvent.VK_X); btnFechar.setToolTipText(GERAL.DICA_SAIR); //btnFechar.getAccessibleContext().setAccessibleDescription(GERAL.DICA_SAIR); menuArquivo.add(btnFechar); btnFechar.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.ALT_MASK)); btnFechar.setMnemonic('X'); btnFechar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.exit(0); } }); menuBar.add(menuArquivo); menuBar.add(this.criaMenuEditar()); menuBar.add(avaliadores); JMenu menuSimuladores = new JMenu(); menuSilvinha.criaMenuSimuladores(menuSimuladores); menuBar.add(menuSimuladores); JMenu mnFerramenta = new JMenu(); menuSilvinha.criaMenuFerramentas(mnFerramenta); menuBar.add(mnFerramenta); JMenu menuAjuda = new JMenu(GERAL.AJUDA); menuSilvinha.criaMenuAjuda(menuAjuda); menuBar.add(menuAjuda); return menuBar; }
From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.imagem.analise_geral.PanelAnaliseGeral.java
/** * Cria o menu editar do Frame Principal * //ww w . ja v a 2 s . c o m * @param menu */ private JMenu criaMenuEditar() { JMenu menu = new JMenu(GERAL.EDITAR); menu.setBackground(parentFrame.corDefault); menu.setMnemonic('E'); menu.setMnemonic(KeyEvent.VK_E); JMenuItem btnContraste = new JMenuItem(GERAL.ALTERAR_CONTRASTE); btnContraste.addActionListener(this); btnContraste.setActionCommand("Contraste"); // btnAumenta.setMnemonic('F'); // btnAumenta.setMnemonic(KeyEvent.VK_F); // btnAumenta.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ADD, // ActionEvent.CTRL_MASK)); btnContraste.setToolTipText(GERAL.DICA_CONTRASTE); btnContraste.getAccessibleContext().setAccessibleDescription(GERAL.DICA_CONTRASTE); menu.add(btnContraste); JMenuItem btnAumenta = new JMenuItem(GERAL.AUMENTA_FONTE); btnAumenta.addActionListener(this); btnAumenta.setActionCommand("AumentaFonte"); // btnAumenta.setMnemonic('F'); // btnAumenta.setMnemonic(KeyEvent.VK_F); btnAumenta.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ADD, ActionEvent.CTRL_MASK)); btnAumenta.setToolTipText(GERAL.DICA_AUMENTA_FONTE); btnAumenta.getAccessibleContext().setAccessibleDescription(GERAL.DICA_AUMENTA_FONTE); menu.add(btnAumenta); JMenuItem btnDiminui = new JMenuItem(GERAL.DIMINUI_FONTE); btnDiminui.addActionListener(this); btnDiminui.setActionCommand("DiminuiFonte"); // btnDiminui.setMnemonic('F'); // btnDiminui.setMnemonic(KeyEvent.VK_F); btnDiminui.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_SUBTRACT, ActionEvent.CTRL_MASK)); btnDiminui.setToolTipText(GERAL.DICA_DIMINUI_FONTE); btnDiminui.getAccessibleContext().setAccessibleDescription(GERAL.DICA_DIMINUI_FONTE); menu.add(btnDiminui); menu.add(new JSeparator()); JMenuItem btnProcurar = new JMenuItem(GERAL.PROCURAR); btnProcurar.addActionListener(this); btnProcurar.setActionCommand("Procurar"); btnProcurar.setMnemonic('P'); btnProcurar.setMnemonic(KeyEvent.VK_P); btnProcurar.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F, ActionEvent.CTRL_MASK)); btnProcurar.setToolTipText(GERAL.DICA_PROCURAR); btnProcurar.getAccessibleContext().setAccessibleDescription(GERAL.DICA_PROCURAR); menu.add(btnProcurar); JMenuItem btnSelecionarTudo = new JMenuItem(GERAL.SELECIONAR_TUDO); btnSelecionarTudo.addActionListener(this); btnSelecionarTudo.setActionCommand("SelecionarTudo"); btnSelecionarTudo.setMnemonic('T'); btnSelecionarTudo.setMnemonic(KeyEvent.VK_T); btnSelecionarTudo.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, ActionEvent.CTRL_MASK)); btnSelecionarTudo.setToolTipText(GERAL.DICA_SELECIONAR_TUDO); btnSelecionarTudo.getAccessibleContext().setAccessibleDescription(GERAL.DICA_SELECIONAR_TUDO); menu.add(btnSelecionarTudo); JMenuItem btnDesfazer = new JMenuItem(GERAL.DESFAZER); btnDesfazer.addActionListener(this); btnDesfazer.setActionCommand("Desfazer"); btnDesfazer.setMnemonic('z'); btnDesfazer.setMnemonic(KeyEvent.VK_Z); btnDesfazer.getAccessibleContext().setAccessibleDescription(GERAL.DICA_DESFAZER); btnDesfazer.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Z, ActionEvent.CTRL_MASK)); menu.add(btnDesfazer); menu.setEnabled(true); return menu; }
From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.imagem.analise_geral.PanelAnaliseGeral.java
private JMenuBar criaMenuBar() { menuBar = new JMenuBar(); menuBar.setBackground(parentFrame.corDefault); JMenu menuArquivo = new JMenu(GERAL.ARQUIVO); menuArquivo.setMnemonic('A'); menuArquivo.setMnemonic(KeyEvent.VK_A); menuArquivo.setBackground(parentFrame.corDefault); JMenu avaliadores = new JMenu(); MenuSilvinha menuSilvinha = new MenuSilvinha(parentFrame, null); menuSilvinha.criaMenuAvaliadores(avaliadores); // menuArquivo.add(avaliadores); // menuArquivo.add(new JSeparator()); JMenuItem btnAbrir = new JMenuItem(GERAL.BTN_ABRIR); btnAbrir.addActionListener(this); btnAbrir.setActionCommand("Abrir"); btnAbrir.setMnemonic('A'); btnAbrir.setAccelerator(//from ww w. ja v a 2 s .c om javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, ActionEvent.CTRL_MASK)); btnAbrir.setMnemonic(KeyEvent.VK_A); btnAbrir.setToolTipText(GERAL.DICA_ABRIR); btnAbrir.getAccessibleContext().setAccessibleDescription(GERAL.DICA_ABRIR); menuArquivo.add(btnAbrir); JMenuItem btnAbrirUrl = new JMenuItem(br.org.acessobrasil.silvinha2.mli.XHTML_Panel.BTN_ABRIR_URL); btnAbrirUrl.addActionListener(this); btnAbrirUrl.setActionCommand("AbrirURL"); btnAbrirUrl.setMnemonic('U'); btnAbrirUrl.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_U, ActionEvent.CTRL_MASK)); btnAbrirUrl.setMnemonic(KeyEvent.VK_U); btnAbrirUrl.setToolTipText(br.org.acessobrasil.silvinha2.mli.XHTML_Panel.DICA_ABRIR); btnAbrirUrl.getAccessibleContext() .setAccessibleDescription(br.org.acessobrasil.silvinha2.mli.XHTML_Panel.DICA_ABRIR); menuArquivo.add(btnAbrirUrl); btnSalvar = new JMenuItem(GERAL.BTN_SALVAR); btnSalvar.addActionListener(this); btnSalvar.setActionCommand("Salvar"); btnSalvar.setMnemonic('S'); btnSalvar.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, ActionEvent.CTRL_MASK)); btnSalvar.setMnemonic(KeyEvent.VK_S); btnSalvar.getAccessibleContext().setAccessibleDescription(GERAL.SALVA_REAVALIA); menuArquivo.add(btnSalvar); JMenuItem btnSalvarAs = new JMenuItem(GERAL.BTN_SALVAR_COMO); btnSalvarAs.addActionListener(this); btnSalvarAs.setActionCommand("SaveAs"); btnSalvarAs.setMnemonic('c'); btnSalvarAs.setMnemonic(KeyEvent.VK_C); // btnSalvarAs.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, // ActionEvent.CTRL_MASK)); btnSalvarAs.setToolTipText(GERAL.DICA_SALVAR_COMO); btnSalvarAs.getAccessibleContext().setAccessibleDescription(GERAL.DICA_SALVAR_COMO); menuArquivo.add(btnSalvarAs); menuArquivo.add(new JSeparator()); JMenuItem btnFechar = new JMenuItem(GERAL.SAIR); btnFechar.addActionListener(this); btnFechar.setActionCommand("Sair"); btnFechar.setMnemonic('a'); btnFechar.setMnemonic(KeyEvent.VK_A); btnFechar.setToolTipText(GERAL.DICA_SAIR); btnFechar.getAccessibleContext().setAccessibleDescription(GERAL.DICA_SAIR); menuArquivo.add(btnFechar); menuBar.add(menuArquivo); menuBar.add(this.criaMenuEditar()); menuBar.add(avaliadores); JMenu menuSimuladores = new JMenu(); menuSilvinha.criaMenuSimuladores(menuSimuladores); menuBar.add(menuSimuladores); JMenu mnFerramenta = new JMenu(); menuSilvinha.criaMenuFerramentas(mnFerramenta); menuBar.add(mnFerramenta); JMenu menuAjuda = new JMenu(GERAL.AJUDA); menuSilvinha.criaMenuAjuda(menuAjuda); menuBar.add(menuAjuda); return menuBar; }
From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.label.PainelLabel.java
/** * Cria o menu editar do Frame Principal * //ww w .j a v a2 s . c om * @param menu */ private JMenu criaMenuEditar() { JMenu menu = new JMenu(GERAL.EDITAR); menu.setBackground(parentFrame.corDefault); menu.setMnemonic('E'); menu.setMnemonic(KeyEvent.VK_E); JMenuItem btnContraste = new JMenuItem(GERAL.ALTERAR_CONTRASTE); btnContraste.addActionListener(this); btnContraste.setActionCommand("Contraste"); // btnAumenta.setMnemonic('F'); // btnAumenta.setMnemonic(KeyEvent.VK_F); // btnAumenta.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ADD, // ActionEvent.CTRL_MASK)); btnContraste.setToolTipText(GERAL.DICA_CONTRASTE); btnContraste.getAccessibleContext().setAccessibleDescription(GERAL.DICA_CONTRASTE); menu.add(btnContraste); JMenuItem btnAumenta = new JMenuItem(GERAL.AUMENTA_FONTE); btnAumenta.addActionListener(this); btnAumenta.setActionCommand("AumentaFonte"); // btnAumenta.setMnemonic('F'); // btnAumenta.setMnemonic(KeyEvent.VK_F); btnAumenta.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ADD, ActionEvent.CTRL_MASK)); btnAumenta.setToolTipText(GERAL.DICA_AUMENTA_FONTE); btnAumenta.getAccessibleContext().setAccessibleDescription(GERAL.DICA_AUMENTA_FONTE); menu.add(btnAumenta); JMenuItem btnDiminui = new JMenuItem(GERAL.DIMINUI_FONTE); btnDiminui.addActionListener(this); btnDiminui.setActionCommand("DiminuiFonte"); // btnDiminui.setMnemonic('F'); // btnDiminui.setMnemonic(KeyEvent.VK_F); btnDiminui.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_SUBTRACT, ActionEvent.CTRL_MASK)); btnDiminui.setToolTipText(GERAL.DICA_DIMINUI_FONTE); btnDiminui.getAccessibleContext().setAccessibleDescription(GERAL.DICA_DIMINUI_FONTE); menu.add(btnDiminui); menu.add(new JSeparator()); JMenuItem btnProcurar = new JMenuItem(GERAL.PROCURAR); btnProcurar.addActionListener(this); btnProcurar.setActionCommand("Procurar"); btnProcurar.setMnemonic('P'); btnProcurar.setMnemonic(KeyEvent.VK_P); btnProcurar.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F, ActionEvent.CTRL_MASK)); btnProcurar.setToolTipText(GERAL.DICA_PROCURAR); btnProcurar.getAccessibleContext().setAccessibleDescription(GERAL.DICA_PROCURAR); menu.add(btnProcurar); JMenuItem btnSelecionarTudo = new JMenuItem(GERAL.SELECIONAR_TUDO); btnSelecionarTudo.addActionListener(this); btnSelecionarTudo.setActionCommand("SelecionarTudo"); btnSelecionarTudo.setMnemonic('T'); btnSelecionarTudo.setMnemonic(KeyEvent.VK_T); btnSelecionarTudo.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, ActionEvent.CTRL_MASK)); btnSelecionarTudo.setToolTipText(GERAL.DICA_SELECIONAR_TODO_CSS); btnSelecionarTudo.getAccessibleContext().setAccessibleDescription(GERAL.DICA_SELECIONAR_TODO_CSS); menu.add(btnSelecionarTudo); JMenuItem btnDesfazer = new JMenuItem(GERAL.DESFAZER); btnDesfazer.addActionListener(this); btnDesfazer.setActionCommand("Desfazer"); btnDesfazer.setMnemonic('z'); btnDesfazer.setMnemonic(KeyEvent.VK_Z); btnDesfazer.getAccessibleContext().setAccessibleDescription(GERAL.DICA_DESFAZER); btnDesfazer.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Z, ActionEvent.CTRL_MASK)); menu.add(btnDesfazer); menu.setEnabled(true); return menu; }
From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.script.PainelScript.java
private JMenuBar criaMenuBar() { menuBar = new JMenuBar(); menuBar.setBackground(parentFrame.corDefault); JMenu menuArquivo = new JMenu(GERAL.ARQUIVO); menuArquivo.setMnemonic('A'); menuArquivo.setMnemonic(KeyEvent.VK_A); menuArquivo.setBackground(parentFrame.corDefault); JMenu avaliadores = new JMenu(); MenuSilvinha menuSilvinha = new MenuSilvinha(parentFrame, null); menuSilvinha.criaMenuAvaliadores(avaliadores); // menuArquivo.add(avaliadores); // menuArquivo.add(new JSeparator()); JMenuItem btnAbrir = new JMenuItem(GERAL.BTN_ABRIR); btnAbrir.addActionListener(this); btnAbrir.setActionCommand("Abrir"); btnAbrir.setMnemonic('A'); btnAbrir.setAccelerator(/* ww w . j a v a2 s.c om*/ javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, ActionEvent.CTRL_MASK)); btnAbrir.setMnemonic(KeyEvent.VK_A); btnAbrir.setToolTipText(GERAL.DICA_ABRIR); btnAbrir.getAccessibleContext().setAccessibleDescription(GERAL.DICA_ABRIR); menuArquivo.add(btnAbrir); JMenuItem btnAbrirUrl = new JMenuItem(br.org.acessobrasil.silvinha2.mli.XHTML_Panel.BTN_ABRIR_URL); btnAbrirUrl.addActionListener(this); btnAbrirUrl.setActionCommand("AbrirURL"); btnAbrirUrl.setMnemonic('U'); btnAbrirUrl.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_U, ActionEvent.CTRL_MASK)); btnAbrirUrl.setMnemonic(KeyEvent.VK_U); btnAbrirUrl.setToolTipText(br.org.acessobrasil.silvinha2.mli.XHTML_Panel.DICA_ABRIR); btnAbrirUrl.getAccessibleContext() .setAccessibleDescription(br.org.acessobrasil.silvinha2.mli.XHTML_Panel.DICA_ABRIR); menuArquivo.add(btnAbrirUrl); btnSalvar = new JMenuItem(GERAL.BTN_SALVAR); btnSalvar.addActionListener(this); btnSalvar.setActionCommand("Salvar"); btnSalvar.setMnemonic('S'); btnSalvar.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, ActionEvent.CTRL_MASK)); btnSalvar.setMnemonic(KeyEvent.VK_S); btnSalvar.getAccessibleContext().setAccessibleDescription(GERAL.DICA_SALVA_REAVALIA); menuArquivo.add(btnSalvar); JMenuItem btnSalvarAs = new JMenuItem(GERAL.BTN_SALVAR_COMO); btnSalvarAs.addActionListener(this); btnSalvarAs.setActionCommand("SaveAs"); btnSalvarAs.setMnemonic('c'); btnSalvarAs.setMnemonic(KeyEvent.VK_C); // btnSalvarAs.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, // ActionEvent.CTRL_MASK)); btnSalvarAs.setToolTipText(GERAL.DICA_SALVAR_COMO); btnSalvarAs.getAccessibleContext().setAccessibleDescription(GERAL.DICA_SALVAR_COMO); menuArquivo.add(btnSalvarAs); menuArquivo.add(new JSeparator()); JMenuItem btnFechar = new JMenuItem(GERAL.SAIR); btnFechar.addActionListener(this); btnFechar.setActionCommand("Sair"); btnFechar.setMnemonic('a'); btnFechar.setMnemonic(KeyEvent.VK_A); btnFechar.setToolTipText(GERAL.DICA_SAIR); btnFechar.getAccessibleContext().setAccessibleDescription(GERAL.DICA_SAIR); menuArquivo.add(btnFechar); menuBar.add(menuArquivo); menuBar.add(this.criaMenuEditar()); menuBar.add(avaliadores); JMenu menuSimuladores = new JMenu(); menuSilvinha.criaMenuSimuladores(menuSimuladores); menuBar.add(menuSimuladores); JMenu mnFerramenta = new JMenu(); menuSilvinha.criaMenuFerramentas(mnFerramenta); menuBar.add(mnFerramenta); JMenu menuAjuda = new JMenu(GERAL.AJUDA); menuSilvinha.criaMenuAjuda(menuAjuda); menuBar.add(menuAjuda); return menuBar; }
From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.objeto.PainelObjeto.java
private JMenuBar criaMenuBar() { menuBar = new JMenuBar(); menuBar.setBackground(parentFrame.corDefault); JMenu menuArquivo = new JMenu(GERAL.ARQUIVO); menuArquivo.setMnemonic('A'); menuArquivo.setMnemonic(KeyEvent.VK_A); menuArquivo.setBackground(parentFrame.corDefault); JMenu avaliadores = new JMenu(); MenuSilvinha menuSilvinha = new MenuSilvinha(parentFrame, null); menuSilvinha.criaMenuAvaliadores(avaliadores); // menuArquivo.add(avaliadores); // menuArquivo.add(new JSeparator()); JMenuItem btnAbrir = new JMenuItem(GERAL.BTN_ABRIR); btnAbrir.addActionListener(this); btnAbrir.setActionCommand("Abrir"); btnAbrir.setMnemonic('A'); btnAbrir.setAccelerator(//from w w w. j a v a 2s .c om javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, ActionEvent.CTRL_MASK)); btnAbrir.setMnemonic(KeyEvent.VK_A); btnAbrir.setToolTipText(GERAL.DICA_ABRIR); btnAbrir.getAccessibleContext().setAccessibleDescription(GERAL.DICA_ABRIR); menuArquivo.add(btnAbrir); JMenuItem btnAbrirUrl = new JMenuItem(br.org.acessobrasil.silvinha2.mli.XHTML_Panel.BTN_ABRIR_URL); btnAbrirUrl.addActionListener(this); btnAbrirUrl.setActionCommand("AbrirURL"); btnAbrirUrl.setMnemonic('U'); btnAbrirUrl.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_U, ActionEvent.CTRL_MASK)); btnAbrirUrl.setMnemonic(KeyEvent.VK_U); btnAbrirUrl.setToolTipText(br.org.acessobrasil.silvinha2.mli.XHTML_Panel.DICA_ABRIR); btnAbrirUrl.getAccessibleContext() .setAccessibleDescription(br.org.acessobrasil.silvinha2.mli.XHTML_Panel.DICA_ABRIR); menuArquivo.add(btnAbrirUrl); btnSalvar = new JMenuItem(GERAL.BTN_SALVAR); btnSalvar.addActionListener(this); btnSalvar.setActionCommand("Salvar"); btnSalvar.setMnemonic('S'); btnSalvar.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, ActionEvent.CTRL_MASK)); btnSalvar.setMnemonic(KeyEvent.VK_S); btnSalvar.getAccessibleContext().setAccessibleDescription(GERAL.DICA_SALVA_REAVALIA); // menuArquivo.add(btnSalvar); JMenuItem btnSalvarAs = new JMenuItem(GERAL.BTN_SALVAR_COMO); btnSalvarAs.addActionListener(this); btnSalvarAs.setActionCommand("SaveAs"); btnSalvarAs.setMnemonic('c'); btnSalvarAs.setMnemonic(KeyEvent.VK_C); // btnSalvarAs.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, // ActionEvent.CTRL_MASK)); btnSalvarAs.setToolTipText(GERAL.DICA_SALVAR_COMO); btnSalvarAs.getAccessibleContext().setAccessibleDescription(GERAL.DICA_SALVAR_COMO); menuArquivo.add(btnSalvarAs); menuArquivo.add(new JSeparator()); JMenuItem btnFechar = new JMenuItem(GERAL.SAIR); btnFechar.addActionListener(this); btnFechar.setActionCommand("Sair"); btnFechar.setMnemonic('a'); btnFechar.setMnemonic(KeyEvent.VK_A); btnFechar.setToolTipText(GERAL.DICA_SAIR); btnFechar.getAccessibleContext().setAccessibleDescription(GERAL.DICA_SAIR); menuArquivo.add(btnFechar); menuBar.add(menuArquivo); menuBar.add(this.criaMenuEditar()); menuBar.add(avaliadores); JMenu menuSimuladores = new JMenu(); menuSilvinha.criaMenuSimuladores(menuSimuladores); menuBar.add(menuSimuladores); JMenu mnFerramenta = new JMenu(); menuSilvinha.criaMenuFerramentas(mnFerramenta); menuBar.add(mnFerramenta); JMenu menuAjuda = new JMenu(GERAL.AJUDA); menuSilvinha.criaMenuAjuda(menuAjuda); menuBar.add(menuAjuda); return menuBar; }
From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.label.PainelLabel.java
private JMenuBar criaMenuBar() { menuBar = new JMenuBar(); menuBar.setBackground(parentFrame.corDefault); JMenu menuArquivo = new JMenu(GERAL.ARQUIVO); menuArquivo.setMnemonic('A'); menuArquivo.setMnemonic(KeyEvent.VK_A); menuArquivo.setBackground(parentFrame.corDefault); JMenu avaliadores = new JMenu(); MenuSilvinha menuSilvinha = new MenuSilvinha(parentFrame, null); menuSilvinha.criaMenuAvaliadores(avaliadores); // menuArquivo.add(avaliadores); // menuArquivo.add(new JSeparator()); JMenuItem btnAbrir = new JMenuItem(GERAL.BTN_ABRIR); btnAbrir.addActionListener(this); btnAbrir.setActionCommand("Abrir"); btnAbrir.setMnemonic('A'); btnAbrir.setAccelerator(// ww w . jav a2s .c o m javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, ActionEvent.CTRL_MASK)); btnAbrir.setMnemonic(KeyEvent.VK_A); btnAbrir.setToolTipText(GERAL.DICA_ABRIR); btnAbrir.getAccessibleContext().setAccessibleDescription(GERAL.DICA_ABRIR); menuArquivo.add(btnAbrir); JMenuItem btnAbrirUrl = new JMenuItem(br.org.acessobrasil.silvinha2.mli.XHTML_Panel.BTN_ABRIR_URL); btnAbrirUrl.addActionListener(this); btnAbrirUrl.setActionCommand("AbrirURL"); btnAbrirUrl.setMnemonic('U'); btnAbrirUrl.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_U, ActionEvent.CTRL_MASK)); btnAbrirUrl.setMnemonic(KeyEvent.VK_U); btnAbrirUrl.setToolTipText(br.org.acessobrasil.silvinha2.mli.XHTML_Panel.DICA_ABRIR); btnAbrirUrl.getAccessibleContext() .setAccessibleDescription(br.org.acessobrasil.silvinha2.mli.XHTML_Panel.DICA_ABRIR); menuArquivo.add(btnAbrirUrl); btnSalvar = new JMenuItem(GERAL.BTN_SALVAR); btnSalvar.addActionListener(this); btnSalvar.setActionCommand("Salvar"); btnSalvar.setMnemonic('S'); btnSalvar.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, ActionEvent.CTRL_MASK)); btnSalvar.setMnemonic(KeyEvent.VK_S); btnSalvar.getAccessibleContext().setAccessibleDescription(GERAL.DICA_SALVAR); menuArquivo.add(btnSalvar); JMenuItem btnSalvarAs = new JMenuItem(GERAL.BTN_SALVAR_COMO); btnSalvarAs.addActionListener(this); btnSalvarAs.setActionCommand("SaveAs"); btnSalvarAs.setMnemonic('c'); btnSalvarAs.setMnemonic(KeyEvent.VK_C); // btnSalvarAs.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, // ActionEvent.CTRL_MASK)); btnSalvarAs.setToolTipText(GERAL.DICA_SALVAR_COMO); btnSalvarAs.getAccessibleContext().setAccessibleDescription(GERAL.DICA_SALVAR_COMO); menuArquivo.add(btnSalvarAs); menuArquivo.add(new JSeparator()); JMenuItem btnFechar = new JMenuItem(GERAL.SAIR); btnFechar.addActionListener(this); btnFechar.setActionCommand("Sair"); btnFechar.setMnemonic('a'); btnFechar.setMnemonic(KeyEvent.VK_A); btnFechar.setToolTipText(GERAL.DICA_SAIR); btnFechar.getAccessibleContext().setAccessibleDescription(GERAL.DICA_SAIR); menuArquivo.add(btnFechar); menuBar.add(menuArquivo); menuBar.add(this.criaMenuEditar()); menuBar.add(avaliadores); JMenu menuSimuladores = new JMenu(); menuSilvinha.criaMenuSimuladores(menuSimuladores); menuBar.add(menuSimuladores); JMenu mnFerramenta = new JMenu(); menuSilvinha.criaMenuFerramentas(mnFerramenta); menuBar.add(mnFerramenta); JMenu menuAjuda = new JMenu(XHTML_Panel.AJUDA); menuSilvinha.criaMenuAjuda(menuAjuda); menuBar.add(menuAjuda); return menuBar; }
From source file:utybo.branchingstorytree.swing.OpenBSTGUI.java
private JMenu createShortMenu() { JMenu shortMenu = new JMenu(); addDarkModeCallback(b -> {//from ww w. ja v a 2 s . com shortMenu.setBackground(b ? OPENBST_BLUE.darker().darker() : OPENBST_BLUE.brighter()); shortMenu.setForeground(b ? Color.WHITE : OPENBST_BLUE); }); shortMenu.setBackground(OPENBST_BLUE.brighter()); shortMenu.setForeground(OPENBST_BLUE); shortMenu.setText(Lang.get("banner.title")); shortMenu.setIcon(new ImageIcon(Icons.getImage("Logo", 16))); JMenuItem label = new JMenuItem(Lang.get("menu.title")); label.setEnabled(false); shortMenu.add(label); shortMenu.addSeparator(); shortMenu.add( new JMenuItem(new AbstractAction(Lang.get("menu.open"), new ImageIcon(Icons.getImage("Open", 16))) { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent e) { openStory(VisualsUtils.askForFile(OpenBSTGUI.this, Lang.get("file.title"))); } })); shortMenu.addSeparator(); shortMenu.add(new JMenuItem( new AbstractAction(Lang.get("menu.create"), new ImageIcon(Icons.getImage("Add Property", 16))) { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent e) { doNewEditor(); } })); JMenu additionalMenu = new JMenu(Lang.get("menu.advanced")); shortMenu.add(additionalMenu); additionalMenu.add(new JMenuItem( new AbstractAction(Lang.get("menu.package"), new ImageIcon(Icons.getImage("Open Archive", 16))) { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent e) { new PackageDialog(instance).setVisible(true); } })); additionalMenu.add(new JMenuItem( new AbstractAction(Lang.get("langcheck"), new ImageIcon(Icons.getImage("LangCheck", 16))) { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent e) { final Map<String, String> languages = new Gson() .fromJson(new InputStreamReader( OpenBST.class.getResourceAsStream( "/utybo/branchingstorytree/swing/lang/langs.json"), StandardCharsets.UTF_8), new TypeToken<Map<String, String>>() { }.getType()); languages.remove("en"); languages.remove("default"); JComboBox<String> jcb = new JComboBox<>(new Vector<>(languages.keySet())); JPanel panel = new JPanel(); panel.add(new JLabel(Lang.get("langcheck.choose"))); panel.add(jcb); int result = JOptionPane.showOptionDialog(OpenBSTGUI.this, panel, Lang.get("langcheck"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null); if (result == JOptionPane.OK_OPTION) { Locale selected = new Locale((String) jcb.getSelectedItem()); if (!Lang.getMap().keySet().contains(selected)) { try { Lang.loadTranslationsFromFile(selected, OpenBST.class .getResourceAsStream("/utybo/branchingstorytree/swing/lang/" + languages.get(jcb.getSelectedItem().toString()))); } catch (UnrespectedModelException | IOException e1) { LOG.warn("Failed to load translation file", e1); } } ArrayList<String> list = new ArrayList<>(); Lang.getLocaleMap(Locale.ENGLISH).forEach((k, v) -> { if (!Lang.getLocaleMap(selected).containsKey(k)) { list.add(k + "\n"); } }); StringBuilder sb = new StringBuilder(); Collections.sort(list); list.forEach(s -> sb.append(s)); JDialog dialog = new JDialog(OpenBSTGUI.this, Lang.get("langcheck")); dialog.getContentPane().setLayout(new MigLayout()); dialog.getContentPane().add(new JLabel(Lang.get("langcheck.result")), "pushx, growx, wrap"); JTextArea area = new JTextArea(); area.setLineWrap(true); area.setWrapStyleWord(true); area.setText(sb.toString()); area.setEditable(false); area.setBorder(BorderFactory.createLoweredBevelBorder()); JScrollPane jsp = new JScrollPane(area); jsp.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); dialog.getContentPane().add(jsp, "pushx, pushy, growx, growy"); dialog.setSize((int) (Icons.getScale() * 300), (int) (Icons.getScale() * 300)); dialog.setLocationRelativeTo(OpenBSTGUI.this); dialog.setModalityType(ModalityType.APPLICATION_MODAL); dialog.setVisible(true); } } })); additionalMenu.add(new JMenuItem( new AbstractAction(Lang.get("menu.debug"), new ImageIcon(Icons.getImage("Code", 16))) { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent e) { DebugInfo.launch(OpenBSTGUI.this); } })); JMenu includedFiles = new JMenu("Included BST files"); for (Entry<String, String> entry : OpenBST.getInternalFiles().entrySet()) { JMenuItem jmi = new JMenuItem(entry.getKey()); jmi.addActionListener(ev -> { String path = "/bst/" + entry.getValue(); InputStream is = OpenBSTGUI.class.getResourceAsStream(path); ProgressMonitorInputStream pmis = new ProgressMonitorInputStream(OpenBSTGUI.this, "Extracting...", is); new Thread(() -> { try { File f = File.createTempFile("openbstinternal", ".bsp"); FileOutputStream fos = new FileOutputStream(f); IOUtils.copy(pmis, fos); openStory(f); } catch (final IOException e) { LOG.error("IOException caught", e); showException(Lang.get("file.error").replace("$e", e.getClass().getSimpleName()) .replace("$m", e.getMessage()), e); } }).start(); }); includedFiles.add(jmi); } additionalMenu.add(includedFiles); shortMenu.addSeparator(); JMenu themesMenu = new JMenu(Lang.get("menu.themes")); shortMenu.add(themesMenu); themesMenu.setIcon(new ImageIcon(Icons.getImage("Color Wheel", 16))); ButtonGroup themesGroup = new ButtonGroup(); JRadioButtonMenuItem jrbmi; jrbmi = new JRadioButtonMenuItem(Lang.get("menu.themes.dark")); if (0 == selectedTheme) { jrbmi.setSelected(true); } jrbmi.addActionListener(e -> switchLaF(0, DARK_THEME)); themesMenu.add(jrbmi); themesGroup.add(jrbmi); jrbmi = new JRadioButtonMenuItem(Lang.get("menu.themes.light")); if (1 == selectedTheme) { jrbmi.setSelected(true); } jrbmi.addActionListener(e -> switchLaF(1, LIGHT_THEME)); themesMenu.add(jrbmi); themesGroup.add(jrbmi); jrbmi = new JRadioButtonMenuItem(Lang.get("menu.themes.debug")); if (2 == selectedTheme) { jrbmi.setSelected(true); } jrbmi.addActionListener(e -> switchLaF(2, DEBUG_THEME)); themesMenu.add(jrbmi); themesGroup.add(jrbmi); JMenu additionalLightThemesMenu = new JMenu(Lang.get("menu.themes.morelight")); int j = 3; for (Map.Entry<String, LookAndFeel> entry : ADDITIONAL_LIGHT_THEMES.entrySet()) { int jf = j; jrbmi = new JRadioButtonMenuItem(entry.getKey()); if (j == selectedTheme) jrbmi.setSelected(true); jrbmi.addActionListener(e -> switchLaF(jf, entry.getValue())); additionalLightThemesMenu.add(jrbmi); themesGroup.add(jrbmi); j++; } themesMenu.add(additionalLightThemesMenu); JMenu additionalDarkThemesMenu = new JMenu(Lang.get("menu.themes.moredark")); for (Map.Entry<String, LookAndFeel> entry : ADDITIONAL_DARK_THEMES.entrySet()) { int jf = j; jrbmi = new JRadioButtonMenuItem(entry.getKey()); if (j == selectedTheme) jrbmi.setSelected(true); jrbmi.addActionListener(e -> switchLaF(jf, entry.getValue())); additionalDarkThemesMenu.add(jrbmi); themesGroup.add(jrbmi); j++; } themesMenu.add(additionalDarkThemesMenu); shortMenu.add(new JMenuItem( new AbstractAction(Lang.get("menu.about"), new ImageIcon(Icons.getImage("About", 16))) { /** * */ private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent e) { new AboutDialog(instance).setVisible(true); } })); return shortMenu; }