Popular Posts
javax.net.ssl.SSLHandshakeException: Connection closed by peer in Android 5.0 Lollipop Recently, there is a error occurs when access website via ssl connection like below although it worked fine several days ago. // Enable SSL... DNS SERVER LIST Google 8.8.8.8 8.8.4.4 TWNIC 192.83.166.11 211.72.210.250 HiNet 168.95.1.1 168.95.192.1 Seednet 北區 DNS (台北, 桃園, 新竹, 宜蘭, 花蓮, 苗栗) 139.... CORS in Asp.net MVC Web API v2 Step 1. Install cors from NeGet Step 2. Enable cors in config using System; using System.Collections.Generic; using System.Linq; using ...
Blog Archive
Stats
Spinner Sample
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Toolkit;

import javax.swing.JFrame;
import javax.swing.JSpinner;
import javax.swing.SpinnerDateModel;
import javax.swing.SpinnerListModel;
import javax.swing.SpinnerNumberModel;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

public class SpinnerSample extends JFrame {

    public SpinnerSample() {
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setSize(new Dimension(500, 500));
        Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
        this.setLocation(new Point((d.width - this.getWidth()) / 2, (d.height - this.getHeight()) / 2));

        GridBagLayout layout = new GridBagLayout();
        GridBagConstraints cons = new GridBagConstraints();
        this.setLayout(layout);

        cons.insets = new Insets(5, 5, 5, 5);
        cons.gridx = 0;
        cons.gridy = 0;
        cons.anchor = GridBagConstraints.WEST;
        cons.fill = GridBagConstraints.HORIZONTAL;

        JSpinner spinner = null;

        spinner = new JSpinner(new SpinnerDateModel());
        //spinner.setEditor(new JSpinner.DateEditor(spinner, "yyyy/MM/dd HH:mm"));
        this.add(spinner);
        layout.setConstraints(spinner, cons);

        cons.gridy++;
        spinner = new JSpinner(new SpinnerListModel(new String[] { "日曜日", "月曜日", "火曜日", "水曜日", "木曜日", "金曜日", "土曜日" }));
        this.add(spinner);
        layout.setConstraints(spinner, cons);

        cons.gridy++;
        spinner = new JSpinner(new SpinnerNumberModel());
        this.add(spinner);
        layout.setConstraints(spinner, cons);

        this.setVisible(true);
        this.pack();
    }

    public static void main(String[] args) {
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } catch (ClassNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (InstantiationException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (UnsupportedLookAndFeelException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        new SpinnerSample();
    }
}