Autopsy  3.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
AdvancedConfigurationDialog.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2011 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 
20 /*
21  * AdvancedConfigurationDialog.java
22  *
23  * Created on Feb 28, 2012, 4:47:31 PM
24  */
25 package org.sleuthkit.autopsy.corecomponents;
26 
27 import java.awt.Component;
28 import java.awt.Dimension;
29 import java.awt.Toolkit;
30 import java.awt.event.ActionListener;
31 import javax.swing.JFrame;
32 import javax.swing.JPanel;
33 
38 public class AdvancedConfigurationDialog extends javax.swing.JDialog {
39 
42  this(false);
43  }
44 
46  public AdvancedConfigurationDialog(boolean resizable) {
47  super(new JFrame(), true);
48  setResizable(resizable);
49  if(resizable) {
50  this.setIconImage(null);
51  }
53  }
54 
55  public void display(JPanel panel) {
56  this.setTitle(panel.getName());
57 
58 
59  panel.setAlignmentX(Component.CENTER_ALIGNMENT);
60  //applyButton.setAlignmentX(Component.CENTER_ALIGNMENT);
61  this.add(panel, 0);
62  this.pack();
63 
64  Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
65  // set the popUp window / JFrame
66  int w = this.getSize().width;
67  int h = this.getSize().height;
68 
69  // set the location of the popUp Window on the center of the screen
70  setLocation((screenDimension.width - w) / 2, (screenDimension.height - h) / 2);
71 
72  this.setVisible(true);
73  }
74 
80  @SuppressWarnings("unchecked")
81  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
82  private void initComponents() {
83 
84  jSeparator1 = new javax.swing.JSeparator();
85  filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 4), new java.awt.Dimension(0, 4), new java.awt.Dimension(0, 4));
86  jPanel1 = new javax.swing.JPanel();
87  applyButton = new javax.swing.JButton();
88  cancelButton = new javax.swing.JButton();
89  filler2 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 4), new java.awt.Dimension(0, 4), new java.awt.Dimension(0, 4));
90 
91  setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
92  getContentPane().setLayout(new javax.swing.BoxLayout(getContentPane(), javax.swing.BoxLayout.PAGE_AXIS));
93  getContentPane().add(jSeparator1);
94  getContentPane().add(filler1);
95 
96  jPanel1.setMaximumSize(new java.awt.Dimension(4000, 27));
97  jPanel1.setMinimumSize(new java.awt.Dimension(100, 27));
98  jPanel1.setPreferredSize(new java.awt.Dimension(400, 27));
99 
100  applyButton.setText(org.openide.util.NbBundle.getMessage(AdvancedConfigurationDialog.class, "AdvancedConfigurationDialog.applyButton.text")); // NOI18N
101 
102  cancelButton.setText(org.openide.util.NbBundle.getMessage(AdvancedConfigurationDialog.class, "AdvancedConfigurationDialog.cancelButton.text")); // NOI18N
103  cancelButton.addActionListener(new java.awt.event.ActionListener() {
104  public void actionPerformed(java.awt.event.ActionEvent evt) {
106  }
107  });
108 
109  javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
110  jPanel1.setLayout(jPanel1Layout);
111  jPanel1Layout.setHorizontalGroup(
112  jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
113  .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
114  .addContainerGap(242, Short.MAX_VALUE)
115  .addComponent(applyButton, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
116  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
117  .addComponent(cancelButton, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
118  .addGap(12, 12, 12))
119  );
120  jPanel1Layout.setVerticalGroup(
121  jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
122  .addGroup(jPanel1Layout.createSequentialGroup()
123  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
124  .addComponent(applyButton)
125  .addComponent(cancelButton))
126  .addGap(0, 4, Short.MAX_VALUE))
127  );
128 
129  getContentPane().add(jPanel1);
130  getContentPane().add(filler2);
131 
132  pack();
133  }// </editor-fold>//GEN-END:initComponents
134 
135  private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
136  close();
137  }//GEN-LAST:event_cancelButtonActionPerformed
138 
139  // Variables declaration - do not modify//GEN-BEGIN:variables
140  private javax.swing.JButton applyButton;
141  private javax.swing.JButton cancelButton;
142  private javax.swing.Box.Filler filler1;
143  private javax.swing.Box.Filler filler2;
144  private javax.swing.JPanel jPanel1;
145  private javax.swing.JSeparator jSeparator1;
146  // End of variables declaration//GEN-END:variables
147 
148  public void addApplyButtonListener(ActionListener l) {
149  this.applyButton.addActionListener(l);
150  }
151 
152  public void close() {
153  dispose();
154  }
155 }

Copyright © 2012-2015 Basis Technology. Generated on: Mon Oct 19 2015
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.