Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.awt.Insets;

import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;

public class Main {
    /**
     * @param label
     * @param iconFileName
     * @return createb JButton used in toolbar
     */
    public static JButton createToolbarButton(String label, String iconFileName) {
        JButton button = new JButton(new ImageIcon(iconFileName));
        button.setFocusPainted(false);
        button.setMargin(new Insets(0, 0, 0, 0));
        button.setToolTipText(label);
        button.setActionCommand(label);
        return button;
    }

    /**
     * @param label
     * @param icon
     * @return createb JButton used in toolbar
     */
    public static JButton createToolbarButton(String label, Icon icon) {
        JButton button = new JButton(icon);
        button.setFocusPainted(false);
        button.setMargin(new Insets(0, 0, 0, 0));
        button.setToolTipText(label);
        button.setActionCommand(label);
        return button;
    }
}