Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
* This file is part of Kayak.
*
* Kayak is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Kayak is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Kayak. If not, see .
*
*/
package com.github.andy2003.ui.messageview;
import java.awt.dnd.DropTarget;
import javax.swing.DefaultComboBoxModel;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableColumnModel;
import org.openide.util.NbBundle;
import org.openide.windows.TopComponent;
import org.netbeans.api.settings.ConvertAsProperties;
import org.openide.util.ImageUtilities;
@ConvertAsProperties(dtd = "-//com.github.andy2003.ui.messageview//MessageView//EN",
autostore = false)
@TopComponent.Description(preferredID = "MessageViewTopComponent",
iconBase="org/tango-project/tango-icon-theme/16x16/status/dialog-information.png",
persistenceType = TopComponent.PERSISTENCE_ALWAYS)
@TopComponent.Registration(mode = "editor", openAtStartup = false)
public final class MessageViewTopComponent extends TopComponent {
private SignalTableModel model = new SignalTableModel();
public MessageViewTopComponent() {
initComponents();
setName(NbBundle.getMessage(MessageViewTopComponent.class, "CTL_MessageViewTopComponent"));
setToolTipText(NbBundle.getMessage(MessageViewTopComponent.class, "HINT_MessageViewTopComponent"));
DropTarget dt = new DropTarget(jTable1, new MessageSignalDropAdapter(model));
jTable1.setDropTarget(dt);
DefaultTableCellRenderer rightRenderer = new DefaultTableCellRenderer();
rightRenderer.setHorizontalAlignment( JLabel.RIGHT);
TableColumnModel cm = jTable1.getColumnModel();
cm.getColumn(1).setCellRenderer(rightRenderer);
cm.getColumn(4).setCellRenderer(rightRenderer);
}
/** 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() {
jToolBar1 = new javax.swing.JToolBar();
jButton1 = new javax.swing.JButton();
jSeparator1 = new javax.swing.JToolBar.Separator();
jLabel1 = new javax.swing.JLabel();
jComboBox1 = new javax.swing.JComboBox();
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
jToolBar1.setFloatable(false);
jToolBar1.setRollover(true);
jButton1.setIcon(new ImageIcon(ImageUtilities.loadImage("org/tango-project/tango-icon-theme/16x16/actions/edit-delete.png")));
org.openide.awt.Mnemonics.setLocalizedText(jButton1, org.openide.util.NbBundle.getMessage(MessageViewTopComponent.class, "MessageViewTopComponent.jButton1.text")); // NOI18N
jButton1.setFocusable(false);
jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
jButton1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jToolBar1.add(jButton1);
jToolBar1.add(jSeparator1);
org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(MessageViewTopComponent.class, "MessageViewTopComponent.jLabel1.text")); // NOI18N
jToolBar1.add(jLabel1);
jComboBox1.setModel(new DefaultComboBoxModel(SignalTableModel.Presentation.values()));
jComboBox1.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent evt) {
jComboBox1ItemStateChanged(evt);
}
});
jToolBar1.add(jComboBox1);
jTable1.setAutoCreateRowSorter(true);
jTable1.setModel(model);
jTable1.setDoubleBuffered(true);
jTable1.setFillsViewportHeight(true);
jScrollPane1.setViewportView(jTable1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, 436, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 436, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 402, Short.MAX_VALUE))
);
}// //GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
int[] rows = jTable1.getSelectedRows();
for(int i=0;i