Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import javax.swing.JToolBar;

public class Main {
    public static void main(String[] argv) throws Exception {
        JToolBar toolbar = new JToolBar();
        toolbar.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                String propName = evt.getPropertyName();
                if ("orientation".equals(propName)) {
                    Integer oldValue = (Integer) evt.getOldValue();
                    Integer newValue = (Integer) evt.getNewValue();
                    if (newValue.intValue() == JToolBar.HORIZONTAL) {
                        System.out.println("horizontal orientation");
                    } else {
                        System.out.println("vertical orientation");
                    }
                }
            }
        });
    }
}