Autopsy  4.0
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 
44  this(false);
45  }
46 
50  public AdvancedConfigurationDialog(boolean resizable) {
51  super(new JFrame(), true);
52  setResizable(resizable);
53  if (resizable) {
54  this.setIconImage(null);
55  }
57  }
58 
59  public void display(JPanel panel) {
60  this.setTitle(panel.getName());
61 
62  panel.setAlignmentX(Component.CENTER_ALIGNMENT);
63  //applyButton.setAlignmentX(Component.CENTER_ALIGNMENT);
64  this.add(panel, 0);
65  this.pack();
66 
67  Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
68  // set the popUp window / JFrame
69  int w = this.getSize().width;
70  int h = this.getSize().height;
71 
72  // set the location of the popUp Window on the center of the screen
73  setLocation((screenDimension.width - w) / 2, (screenDimension.height - h) / 2);
74 
75  this.setVisible(true);
76  }
77 
83  @SuppressWarnings("unchecked")
84  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
85  private void initComponents() {
86 
87  jSeparator1 = new javax.swing.JSeparator();
88  filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 4), new java.awt.Dimension(0, 4), new java.awt.Dimension(0, 4));
89  jPanel1 = new javax.swing.JPanel();
90  applyButton = new javax.swing.JButton();
91  cancelButton = new javax.swing.JButton();
92  filler2 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 4), new java.awt.Dimension(0, 4), new java.awt.Dimension(0, 4));
93 
94  setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
95  getContentPane().setLayout(new javax.swing.BoxLayout(getContentPane(), javax.swing.BoxLayout.PAGE_AXIS));
96  getContentPane().add(jSeparator1);
97  getContentPane().add(filler1);
98 
99  jPanel1.setMaximumSize(new java.awt.Dimension(4000, 27));
100  jPanel1.setMinimumSize(new java.awt.Dimension(100, 27));
101  jPanel1.setPreferredSize(new java.awt.Dimension(400, 27));
102 
103  applyButton.setText(org.openide.util.NbBundle.getMessage(AdvancedConfigurationDialog.class, "AdvancedConfigurationDialog.applyButton.text")); // NOI18N
104 
105  cancelButton.setText(org.openide.util.NbBundle.getMessage(AdvancedConfigurationDialog.class, "AdvancedConfigurationDialog.cancelButton.text")); // NOI18N
106  cancelButton.addActionListener(new java.awt.event.ActionListener() {
107  public void actionPerformed(java.awt.event.ActionEvent evt) {
109  }
110  });
111 
112  javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
113  jPanel1.setLayout(jPanel1Layout);
114  jPanel1Layout.setHorizontalGroup(
115  jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
116  .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
117  .addContainerGap(242, Short.MAX_VALUE)
118  .addComponent(applyButton, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
119  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
120  .addComponent(cancelButton, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
121  .addGap(12, 12, 12))
122  );
123  jPanel1Layout.setVerticalGroup(
124  jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
125  .addGroup(jPanel1Layout.createSequentialGroup()
126  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
127  .addComponent(applyButton)
128  .addComponent(cancelButton))
129  .addGap(0, 4, Short.MAX_VALUE))
130  );
131 
132  getContentPane().add(jPanel1);
133  getContentPane().add(filler2);
134 
135  pack();
136  }// </editor-fold>//GEN-END:initComponents
137 
138  private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
139  close();
140  }//GEN-LAST:event_cancelButtonActionPerformed
141 
142  // Variables declaration - do not modify//GEN-BEGIN:variables
143  private javax.swing.JButton applyButton;
144  private javax.swing.JButton cancelButton;
145  private javax.swing.Box.Filler filler1;
146  private javax.swing.Box.Filler filler2;
147  private javax.swing.JPanel jPanel1;
148  private javax.swing.JSeparator jSeparator1;
149  // End of variables declaration//GEN-END:variables
150 
151  public void addApplyButtonListener(ActionListener l) {
152  this.applyButton.addActionListener(l);
153  }
154 
155  public void close() {
156  dispose();
157  }
158 }

Copyright © 2012-2015 Basis Technology. Generated on: Wed Apr 6 2016
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.