it.tidalwave.netbeans.swing.OneShotMessagePanel Maven / Gradle / Ivy
/***********************************************************************************************************************
*
* OpenBlueSky - NetBeans Platform Enhancements
* Copyright (C) 2006-2011 by Tidalwave s.a.s. (http://www.tidalwave.it)
*
***********************************************************************************************************************
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
***********************************************************************************************************************
*
* WWW: http://openbluesky.kenai.com
* SCM: https://kenai.com/hg/openbluesky~src
*
**********************************************************************************************************************/
package it.tidalwave.netbeans.swing;
import java.awt.Dialog;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JPanel;
/*******************************************************************************
*
* @author Fabrizio Giudici
* @version $Id$
*
******************************************************************************/
public class OneShotMessagePanel extends JPanel
{
/** Creates new form SingleShotMessagePanel */
public OneShotMessagePanel()
{
initComponents();
}
public OneShotMessagePanel (final String message, final Dialog dialog)
{
this();
lbTest.setText(message);
btOk.addActionListener(new ActionListener()
{
public void actionPerformed (final ActionEvent event)
{
dialog.setVisible(false);
}
});
}
public boolean isShowNextTimeSelected()
{
return cbShowNextTime.isSelected();
}
/**
* 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() {
lbTest = new javax.swing.JLabel();
cbShowNextTime = new javax.swing.JCheckBox();
btOk = new javax.swing.JButton();
lbTest.setText(org.openide.util.NbBundle.getMessage(OneShotMessagePanel.class, "OneShotMessagePanel.lbTest.text_1")); // NOI18N
lbTest.setVerticalAlignment(javax.swing.SwingConstants.TOP);
lbTest.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
cbShowNextTime.setText(org.openide.util.NbBundle.getMessage(OneShotMessagePanel.class, "OneShotMessagePanel.cbShowNextTime.text_1")); // NOI18N
cbShowNextTime.setMargin(new java.awt.Insets(0, 0, 0, 0));
btOk.setText(org.openide.util.NbBundle.getMessage(OneShotMessagePanel.class, "OneShotMessagePanel.btOk.text_1")); // NOI18N
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lbTest, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 534, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addComponent(cbShowNextTime)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 318, Short.MAX_VALUE)
.addComponent(btOk, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addComponent(lbTest, javax.swing.GroupLayout.DEFAULT_SIZE, 227, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cbShowNextTime)
.addComponent(btOk))
.addContainerGap())
);
}// //GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btOk;
private javax.swing.JCheckBox cbShowNextTime;
private javax.swing.JLabel lbTest;
// End of variables declaration//GEN-END:variables
}