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

Copyright © 2012-2016 Basis Technology. Generated on: Fri Sep 29 2017
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.