All Downloads are FREE. Search and download functionalities are using the official Maven repository.

test.RolloverIconTest Maven / Gradle / Ivy

Go to download

A Mavenisation of the Quaqua Mac OSX Swing Look and Feel (Java library) Quaqua Look and Feel (C) 2003-2010, Werner Randelshofer. Mavenisation by Matt Gumbley, DevZendo.org - for problems with Mavenisation, see Matt; for issues with Quaqua, see the Quaqua home page. For full license details, see http://randelshofer.ch/quaqua/license.html

The newest version!
/*
 * @(#)RolloverIconTest.java 
 *
 * Copyright (c) 2004-2010 Werner Randelshofer, Immensee, Switzerland.
 * All rights reserved.
 *
 * You may not use, copy or modify this file, except in compliance with the
 * license agreement you entered into with Werner Randelshofer.
 * For details see accompanying license terms.
 */

package test;

import ch.randelshofer.quaqua.*;
import javax.swing.*;
import javax.swing.border.*;

/**
 * RolloverIconTest.
 * 
 * @author Werner Randelshofer
 * @version $Id: RolloverIconTest.java 363 2010-11-21 17:41:04Z wrandelshofer $
 */
public class RolloverIconTest extends javax.swing.JPanel {
    
    /** Creates new form. */
    public RolloverIconTest() {
        initComponents();
        AbstractButton[] buttons = { button1, button2, toggle1, toggle2 };
        Icon icon = new TextIcon("Default       ");
        for (int i=0; i < buttons.length; i++) {
            buttons[i].setIcon(icon);
        }
        icon = new TextIcon("Pressed");
        for (int i=0; i < buttons.length; i++) {
            buttons[i].setPressedIcon(icon);
        }
        icon = new TextIcon("Selected");
        for (int i=0; i < buttons.length; i++) {
            buttons[i].setSelectedIcon(icon);
        }
        icon = new TextIcon("Rollover");
        for (int i=0; i < buttons.length; i++) {
            buttons[i].setRolloverIcon(icon);
        }
        icon = new TextIcon("Roll.+Sel.");
        for (int i=0; i < buttons.length; i++) {
            buttons[i].setRolloverSelectedIcon(icon);
        }
        icon = new TextIcon("Disabled");
        for (int i=0; i < buttons.length; i++) {
            buttons[i].setDisabledIcon(icon);
        }
        icon = new TextIcon("Dis.+Sel.");
        for (int i=0; i < buttons.length; i++) {
            buttons[i].setDisabledSelectedIcon(icon);
        }
    }
    
    public static void main(String args[]) {
        
        try {
            UIManager.setLookAndFeel(QuaquaManager.getLookAndFeelClassName());
            UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
        } catch (Exception e) {
            e.printStackTrace();
        }
        JFrame f = new JFrame("Quaqua Rollover Icon Test");
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.getContentPane().add(new RolloverIconTest());
        ((JComponent) f.getContentPane()).setBorder(new EmptyBorder(9,17,17,17));
        f.pack();
        f.setVisible(true);
    }
    
    /** 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.
     */
    // //GEN-BEGIN:initComponents
    private void initComponents() {
        java.awt.GridBagConstraints gridBagConstraints;

        button1 = new javax.swing.JButton();
        toggle1 = new javax.swing.JToggleButton();
        jPanel1 = new javax.swing.JPanel();
        jToolBar1 = new javax.swing.JToolBar();
        button2 = new javax.swing.JButton();
        toggle2 = new javax.swing.JToggleButton();

        FormListener formListener = new FormListener();

        setLayout(new java.awt.GridBagLayout());

        button1.setText("Ångström H");
        button1.addActionListener(formListener);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        add(button1, gridBagConstraints);

        toggle1.setText("Ångström H");
        add(toggle1, new java.awt.GridBagConstraints());

        jPanel1.setLayout(new java.awt.BorderLayout());

        jToolBar1.setRollover(true);

        button2.setText("Ångström H");
        jToolBar1.add(button2);

        toggle2.setText("Ångström H");
        jToolBar1.add(toggle2);

        jPanel1.add(jToolBar1, java.awt.BorderLayout.NORTH);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
        add(jPanel1, gridBagConstraints);
    }

    // Code for dispatching events from components to event handlers.

    private class FormListener implements java.awt.event.ActionListener {
        FormListener() {}
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            if (evt.getSource() == button1) {
                RolloverIconTest.this.button1ActionPerformed(evt);
            }
        }
    }// //GEN-END:initComponents
    
    private void button1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_button1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_button1ActionPerformed
    
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton button1;
    private javax.swing.JButton button2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JToolBar jToolBar1;
    private javax.swing.JToggleButton toggle1;
    private javax.swing.JToggleButton toggle2;
    // End of variables declaration//GEN-END:variables
    
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy