2529N/A/*
2529N/A * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
2529N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2529N/A *
2529N/A * This code is free software; you can redistribute it and/or modify it
2529N/A * under the terms of the GNU General Public License version 2 only, as
2529N/A * published by the Free Software Foundation.
2529N/A *
2529N/A * This code is distributed in the hope that it will be useful, but WITHOUT
2529N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2529N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2529N/A * version 2 for more details (a copy is included in the LICENSE file that
2529N/A * accompanied this code).
2529N/A *
2529N/A * You should have received a copy of the GNU General Public License version
2529N/A * 2 along with this work; if not, write to the Free Software Foundation,
2529N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2529N/A *
2529N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2529N/A * or visit www.oracle.com if you need additional information or have any
2529N/A * questions.
2529N/A */
2529N/A
2529N/A/*
2529N/A * @test
2529N/A * @bug 4129681
2529N/A * @summary Tests enabling/disabling of titled border's caption
2529N/A * @author Sergey Malenkov
2529N/A * @run applet/manual=yesno Test4129681.html
2529N/A */
2529N/A
2529N/Aimport java.awt.BorderLayout;
2529N/Aimport java.awt.event.ItemEvent;
2529N/Aimport java.awt.event.ItemListener;
2529N/Aimport javax.swing.BorderFactory;
2529N/Aimport javax.swing.JApplet;
2529N/Aimport javax.swing.JCheckBox;
2529N/Aimport javax.swing.JLabel;
2529N/A
2529N/Apublic class Test4129681 extends JApplet implements ItemListener {
2529N/A private JLabel label;
2529N/A
2529N/A @Override
2529N/A public void init() {
2529N/A JCheckBox check = new JCheckBox("disable");
2529N/A check.addItemListener(this);
2529N/A
2529N/A this.label = new JLabel("message");
2529N/A this.label.setBorder(BorderFactory.createTitledBorder("label"));
2529N/A this.label.setEnabled(!check.isSelected());
2529N/A
2529N/A add(BorderLayout.NORTH, check);
2529N/A add(BorderLayout.CENTER, this.label);
2529N/A }
2529N/A
2529N/A public void itemStateChanged(ItemEvent event) {
2529N/A this.label.setEnabled(ItemEvent.DESELECTED == event.getStateChange());
2529N/A }
2529N/A}