use of javax.swing.JToggleButton in project energy3d by concord-consortium.
the class MainPanel method getRoofButton.
private JToggleButton getRoofButton() {
if (roofButton == null) {
roofButton = new JToggleButton();
roofButton.setIcon(new ImageIcon(getClass().getResource("icons/pyramid_roof.png")));
roofButton.setToolTipText("Draw pyramid roof");
roofButton.setFocusable(false);
roofButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
SceneManager.getInstance().setOperation(roofCommand);
((Component) SceneManager.getInstance().getCanvas()).requestFocusInWindow();
}
});
roofButton.addMouseListener(operationStickAndRefreshUponExit);
addMouseOverEffect(roofButton);
}
return roofButton;
}
use of javax.swing.JToggleButton in project energy3d by concord-consortium.
the class MainPanel method getNoteButton.
public JToggleButton getNoteButton() {
if (noteButton == null) {
noteButton = new JToggleButton();
noteButton.setToolTipText("Show note");
noteButton.setIcon(new ImageIcon(MainPanel.class.getResource("icons/note.png")));
noteButton.setFocusable(false);
noteButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
MainPanel.getInstance().setNoteVisible(noteButton.isSelected());
if (noteButton.isSelected()) {
getNoteTextArea().requestFocusInWindow();
}
}
});
addMouseOverEffect(noteButton);
}
return noteButton;
}
use of javax.swing.JToggleButton in project Brino by BrinoOficial.
the class FileUtils method abrirFile.
public static void abrirFile(RSyntaxTextArea rSyntaxTextArea) {
JFileChooser FC = new JFileChooser(BrinoDirectory);
FC.addChoosableFileFilter(new FileFilter() {
@Override
public boolean accept(File file) {
return file.getName().toUpperCase().contains(".BRPP") || file.isDirectory();
}
@Override
public String getDescription() {
return "Arquivos de Código Brino";
}
});
for (Component i : FC.getComponents()) {
try {
boolean a = true;
for (Component c : ((JPanel) i).getComponents()) {
if (c.getClass().toString().equals("class javax.swing.plaf.metal.MetalFileChooserUI$1")) {
JComboBox jcom = (JComboBox) c;
jcom.setBackground(UIConstants.VERDE);
jcom.setForeground(Color.white);
jcom.setBorder(new BubbleBorder(UIConstants.VERDE));
for (int z = 0; z < jcom.getComponentCount(); z++) {
if (jcom.getComponent(z) instanceof JComponent) {
((JComponent) jcom.getComponent(z)).setBorder(UIConstants.BORDAVAZIA);
}
if (jcom.getComponent(z) instanceof AbstractButton) {
((AbstractButton) jcom.getComponent(z)).setBorderPainted(false);
}
}
}
if (c.getClass() == javax.swing.JLabel.class) {
c.setForeground(Color.WHITE);
}
if (c.getClass() == javax.swing.JPanel.class) {
for (Component d : ((JPanel) c).getComponents()) {
if (d.getClass() == javax.swing.JToggleButton.class) {
JToggleButton jtg = (JToggleButton) d;
if (jtg.getToolTipText().equals("List")) {
jtg.setIcon(list);
jtg.setSelectedIcon(listFocus);
jtg.setBackground(UIConstants.CINZA);
jtg.setBorder(UIConstants.BORDAVAZIA);
jtg.setRolloverIcon(listFocus);
} else {
jtg.setIcon(details);
jtg.setSelectedIcon(detailsFocus);
jtg.setBorder(UIConstants.BORDAVAZIA);
jtg.setBackground(UIConstants.CINZA);
jtg.setRolloverIcon(detailsFocus);
}
}
if (d.getClass() == javax.swing.JComboBox.class) {
JComboBox jcom = (JComboBox) d;
jcom.setBackground(UIConstants.VERDE);
jcom.setForeground(Color.white);
jcom.setBorder(new BubbleBorder(UIConstants.VERDE));
for (int z = 0; z < jcom.getComponentCount(); z++) {
if (jcom.getComponent(z) instanceof JComponent) {
((JComponent) jcom.getComponent(z)).setBorder(UIConstants.BORDAVAZIA);
}
if (jcom.getComponent(z) instanceof AbstractButton) {
((AbstractButton) jcom.getComponent(z)).setBorderPainted(false);
}
}
}
if (d.getClass() != javax.swing.JButton.class && d.getClass() != javax.swing.JComboBox.class)
d.setForeground(Color.WHITE);
else if (d.getClass() == javax.swing.JButton.class) {
// d.setBackground(UIConstants.VERDE);
JButton btn = (JButton) d;
if (btn.getText() != null) {
if (btn.getText().equals("Open")) {
btn.setBorder(new BubbleBorder(UIConstants.VERDE));
btn.setForeground(Color.white);
btn.setText("Abrir");
btn.setBackground(UIConstants.VERDE);
}
if (btn.getText().equals("Cancel")) {
btn.setBorder(new BubbleBorder(UIConstants.CINZACLARO));
btn.setForeground(Color.white);
btn.setText("Cancelar");
btn.setBackground(UIConstants.CINZACLARO);
}
}
if (btn.getActionCommand().equals("Go Up")) {
btn.setIcon(goup);
btn.setBorder(UIConstants.BORDAVAZIA);
btn.setBackground(UIConstants.CINZA);
btn.setRolloverIcon(goupFocus);
} else if (btn.getActionCommand().equals("New Folder")) {
btn.setIcon(newFolder);
btn.setBorder(UIConstants.BORDAVAZIA);
btn.setBackground(UIConstants.CINZA);
btn.setRolloverIcon(newFolderFocus);
} else if (btn.getToolTipText().equals("Home")) {
btn.setIcon(homeFolder);
btn.setBorder(UIConstants.BORDAVAZIA);
btn.setBackground(UIConstants.CINZA);
btn.setRolloverIcon(homeFolderFocus);
}
}
if (d.getClass() == javax.swing.JScrollPane.class) {
setScroll((JScrollPane) d);
}
}
}
}
} catch (java.lang.ClassCastException e) {
e.printStackTrace();
}
}
FC.setAcceptAllFileFilterUsed(false);
int res = FC.showOpenDialog(null);
if (res == JFileChooser.APPROVE_OPTION) {
rSyntaxTextArea.setText(null);
setDiretorio(FC.getSelectedFile());
try {
String f = "";
Scanner in = new Scanner(new File(getDiretorio().getAbsolutePath()));
while (in.hasNext()) {
String line = in.nextLine();
// Highlight
f += (line + "\n");
System.out.println(line);
}
rSyntaxTextArea.setText(f);
in.close();
} catch (FileNotFoundException e1) {
e1.printStackTrace();
}
} else
JOptionPane.showMessageDialog(null, "Voce nao selecionou nenhum diretorio.");
}
use of javax.swing.JToggleButton in project artisynth_core by artisynth.
the class GLViewerTest method createMenuButtons.
protected void createMenuButtons() {
JPopupMenu.setDefaultLightWeightPopupEnabled(false);
JMenuBar menuBar = new JMenuBar();
myQuitButton = new JButton("quit");
myQuitButton.addActionListener(this);
menuBar.add(myQuitButton);
JMenu draggerMenu = new JMenu("dragger");
myNoneItem = new JMenuItem("none");
myNoneItem.addActionListener(this);
draggerMenu.add(myNoneItem);
myJackItem = new JMenuItem("jack");
myJackItem.addActionListener(this);
draggerMenu.add(myJackItem);
myTranslatorItem = new JMenuItem("translator");
myTranslatorItem.addActionListener(this);
draggerMenu.add(myTranslatorItem);
myRotatorItem = new JMenuItem("rotator");
myRotatorItem.addActionListener(this);
draggerMenu.add(myRotatorItem);
menuBar.add(draggerMenu);
myOrthoButton = new JToggleButton("ortho");
myOrthoButton.setSelected(false);
myOrthoButton.addActionListener(this);
menuBar.add(myOrthoButton);
setJMenuBar(menuBar);
}
use of javax.swing.JToggleButton in project chatty by chatty.
the class EmotesDialog method showPanel.
private void showPanel(EmotesPanel panel) {
panel.update();
cardLayout.show(emotesPanel, panel.label);
for (JToggleButton button : buttons.keySet()) {
if (buttons.get(button) == panel) {
button.setSelected(true);
}
}
}
Aggregations