1 239 stephen /* 2 239 stephen * CDDL HEADER START 3 239 stephen * 4 239 stephen * The contents of this file are subject to the terms of the 5 239 stephen * Common Development and Distribution License (the "License"). 6 239 stephen * You may not use this file except in compliance with the License. 7 239 stephen * 8 239 stephen * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 239 stephen * or http://www.opensolaris.org/os/licensing. 10 239 stephen * See the License for the specific language governing permissions 11 239 stephen * and limitations under the License. 12 239 stephen * 13 239 stephen * When distributing Covered Code, include this CDDL HEADER in each 14 239 stephen * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 239 stephen * If applicable, add the following below this CDDL HEADER, with the 16 239 stephen * fields enclosed by brackets "[]" replaced with your own identifying 17 239 stephen * information: Portions Copyright [yyyy] [name of copyright owner] 18 239 stephen * 19 239 stephen * CDDL HEADER END 20 239 stephen */ 21 239 stephen 22 239 stephen /* 23 239 stephen * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 24 239 stephen * Use is subject to license terms. 25 239 stephen */ 26 239 stephen 27 239 stephen package org.opensolaris.os.vp.panels.example.time1.client.swing; 28 239 stephen 29 239 stephen import java.awt.*; 30 239 stephen import javax.swing.*; 31 239 stephen import org.opensolaris.os.vp.util.misc.Finder; 32 239 stephen 33 239 stephen @SuppressWarnings({"serial"}) 34 239 stephen public class TimePanel extends JPanel { 35 239 stephen // 36 239 stephen // Instance data 37 239 stephen // 38 239 stephen 39 239 stephen private SpinnerDateModel model; 40 239 stephen 41 239 stephen // 42 239 stephen // Constructors 43 239 stephen // 44 239 stephen 45 239 stephen public TimePanel() { 46 239 stephen JLabel label = new JLabel(Finder.getString("time.label")); 47 239 stephen model = new SpinnerDateModel(); 48 239 stephen JSpinner spinner = new JSpinner(model); 49 239 stephen 50 239 stephen JPanel panel = new JPanel(new BorderLayout(5, 0)); 51 239 stephen panel.add(label, BorderLayout.WEST); 52 239 stephen panel.add(spinner, BorderLayout.EAST); 53 239 stephen 54 239 stephen setLayout(new GridBagLayout()); 55 239 stephen add(panel); 56 239 stephen } 57 239 stephen 58 239 stephen // 59 239 stephen // TimePanel methods 60 239 stephen // 61 239 stephen 62 239 stephen public SpinnerDateModel getSpinnerDateModel() { 63 239 stephen return model; 64 239 stephen } 65 239 stephen } 66