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

test.TabbedPaneTestHTML 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!
/*
 * @(#)TabbedPaneTestHTML.java  1.0  February 19, 2006
 *
 * Copyright (c) 2006 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 java.awt.*;
import java.text.DateFormat;
import java.util.Calendar;
import java.util.Date;
import javax.swing.*;

/**
 * TabbedPaneTestHTML.
 * 
 * @author Werner Randelshofer
 * @version 1.0 February 19, 2006 Created.
 */
public class TabbedPaneTestHTML extends javax.swing.JPanel {
    
    /**
     * Creates a new instance.
     */
    public TabbedPaneTestHTML() {
        initComponents();
        
        scrollPane.putClientProperty("Quaqua.TabbedPaneChild.contentInsets", new Insets(0,0,0,0));
        scrollPane.putClientProperty("Quaqua.TabbedPaneChild.contentBackground", Color.white);
       // tabbedPane.setTabLayoutPolicy(JTabbedPane.WRAP_TAB_LAYOUT);
        
    }
    
   public static void main(String args[]) {
      // System.setProperty("Quaqua.tabLayoutPolicy","wrap");
        try {
            UIManager.setLookAndFeel(QuaquaManager.getLookAndFeelClassName());
        } catch (Exception e) {
            e.printStackTrace();
        }
        JFrame f = new JFrame("TabbedPaneTest3 "+UIManager.getLookAndFeel().getName());
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.getContentPane().add(new TabbedPaneTestHTML());
        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() {

        tabbedPane = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        scrollPane = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();
        jPanel2 = new javax.swing.JPanel();
        jButton1 = new javax.swing.JButton();

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

        tabbedPane.addTab("Options", jPanel1);

        scrollPane.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));

        jTextArea1.setText("Lorem Ipsum");
        scrollPane.setViewportView(jTextArea1);

        tabbedPane.addTab("Notes", scrollPane);

        add(tabbedPane, java.awt.BorderLayout.CENTER);

        jButton1.setText("Change Tab Titles");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                toggleLabelsPerformed(evt);
            }
        });
        jPanel2.add(jButton1);

        add(jPanel2, java.awt.BorderLayout.SOUTH);
    }// //GEN-END:initComponents

    private void toggleLabelsPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_toggleLabelsPerformed
       tabbedPane.setTitleAt(0, ""+DateFormat.getDateInstance().format(new Date()));
              tabbedPane.setTitleAt(1, ""+DateFormat.getTimeInstance().format(new Date()));
    }//GEN-LAST:event_toggleLabelsPerformed
    
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JTextArea jTextArea1;
    private javax.swing.JScrollPane scrollPane;
    private javax.swing.JTabbedPane tabbedPane;
    // End of variables declaration//GEN-END:variables
    
}