001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.modules.vmd.game.preview;
043:
044: import org.netbeans.modules.vmd.game.model.StaticTile;
045: import org.netbeans.modules.vmd.game.view.ImagePreviewComponent;
046:
047: public class StaticTilePreview extends javax.swing.JPanel {
048:
049: private StaticTile staticTile;
050: private ImagePreviewComponent imagePreviewComponent;
051:
052: /** Creates new form SpritePreview */
053: public StaticTilePreview(StaticTile staticTile) {
054: this .staticTile = staticTile;
055: this .imagePreviewComponent = new ImagePreviewComponent(true);
056: this .imagePreviewComponent.setPreviewable(this .staticTile);
057: initComponents();
058: }
059:
060: /** This method is called from within the constructor to
061: * initialize the form.
062: * WARNING: Do NOT modify this code. The content of this method is
063: * always regenerated by the Form Editor.
064: */
065: // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
066: private void initComponents() {
067:
068: labelSprite = new javax.swing.JLabel();
069: textFieldSprite = new javax.swing.JTextField();
070: panelImagePreview = new javax.swing.JPanel();
071: labelFrames = new javax.swing.JLabel();
072: textFieldFrames = new javax.swing.JTextField();
073: labelDelay = new javax.swing.JLabel();
074: textFieldDelay = new javax.swing.JTextField();
075: jLabel1 = new javax.swing.JLabel();
076: jTextField1 = new javax.swing.JTextField();
077:
078: setMinimumSize(new java.awt.Dimension(10, 180));
079:
080: labelSprite.setText(org.openide.util.NbBundle.getMessage(
081: StaticTilePreview.class,
082: "StaticTilePreview.labelTileIndex.txt")); // NOI18N
083:
084: textFieldSprite.setEditable(false);
085: textFieldSprite.setText(Integer.toString(this .staticTile
086: .getIndex()));
087: textFieldSprite.setBorder(null);
088:
089: panelImagePreview.setBackground(new java.awt.Color(255, 255,
090: 255));
091: panelImagePreview.setBorder(javax.swing.BorderFactory
092: .createLineBorder(new java.awt.Color(153, 153, 153)));
093: this .panelImagePreview.add(this .imagePreviewComponent);
094: panelImagePreview.setLayout(new java.awt.BorderLayout());
095:
096: labelFrames.setText(org.openide.util.NbBundle.getMessage(
097: StaticTilePreview.class,
098: "StaticTilePreview.labelWidth.txt")); // NOI18N
099:
100: textFieldFrames.setEditable(false);
101: textFieldFrames
102: .setHorizontalAlignment(javax.swing.JTextField.LEFT);
103: textFieldFrames.setText(Integer.toString(this .staticTile
104: .getWidth()));
105: textFieldFrames.setBorder(null);
106:
107: labelDelay.setText(org.openide.util.NbBundle.getMessage(
108: StaticTilePreview.class,
109: "StaticTilePreview.labelHeight.txt")); // NOI18N
110:
111: textFieldDelay.setEditable(false);
112: textFieldDelay
113: .setHorizontalAlignment(javax.swing.JTextField.LEFT);
114: textFieldDelay.setText(Integer.toString(this .staticTile
115: .getHeight()));
116: textFieldDelay.setBorder(null);
117:
118: jLabel1.setText(org.openide.util.NbBundle.getMessage(
119: StaticTilePreview.class,
120: "StaticTilePreview.labelImage.txt")); // NOI18N
121:
122: jTextField1.setEditable(false);
123: jTextField1.setText(this .staticTile.getImageResource().getURL()
124: .toString());
125: jTextField1.setBorder(null);
126:
127: org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(
128: this );
129: this .setLayout(layout);
130: layout
131: .setHorizontalGroup(layout
132: .createParallelGroup(
133: org.jdesktop.layout.GroupLayout.LEADING)
134: .add(
135: layout
136: .createSequentialGroup()
137: .addContainerGap()
138: .add(
139: layout
140: .createParallelGroup(
141: org.jdesktop.layout.GroupLayout.LEADING)
142: .add(
143: layout
144: .createSequentialGroup()
145: .add(
146: layout
147: .createParallelGroup(
148: org.jdesktop.layout.GroupLayout.LEADING,
149: false)
150: .add(
151: org.jdesktop.layout.GroupLayout.TRAILING,
152: jLabel1,
153: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
154: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
155: Short.MAX_VALUE)
156: .add(
157: labelFrames))
158: .addPreferredGap(
159: org.jdesktop.layout.LayoutStyle.RELATED)
160: .add(
161: layout
162: .createParallelGroup(
163: org.jdesktop.layout.GroupLayout.LEADING)
164: .add(
165: layout
166: .createSequentialGroup()
167: .add(
168: textFieldFrames,
169: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
170: 28,
171: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
172: .addPreferredGap(
173: org.jdesktop.layout.LayoutStyle.RELATED)
174: .add(
175: labelDelay,
176: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
177: 44,
178: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
179: .addPreferredGap(
180: org.jdesktop.layout.LayoutStyle.RELATED)
181: .add(
182: textFieldDelay,
183: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
184: 8,
185: Short.MAX_VALUE))
186: .add(
187: jTextField1,
188: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
189: 104,
190: Short.MAX_VALUE))
191: .add(
192: 24,
193: 24,
194: 24))
195: .add(
196: org.jdesktop.layout.GroupLayout.TRAILING,
197: layout
198: .createSequentialGroup()
199: .add(
200: layout
201: .createParallelGroup(
202: org.jdesktop.layout.GroupLayout.TRAILING)
203: .add(
204: org.jdesktop.layout.GroupLayout.LEADING,
205: panelImagePreview,
206: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
207: 169,
208: Short.MAX_VALUE)
209: .add(
210: layout
211: .createSequentialGroup()
212: .add(
213: labelSprite)
214: .addPreferredGap(
215: org.jdesktop.layout.LayoutStyle.RELATED)
216: .add(
217: textFieldSprite,
218: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
219: 93,
220: Short.MAX_VALUE)))
221: .addContainerGap()))));
222: layout
223: .setVerticalGroup(layout
224: .createParallelGroup(
225: org.jdesktop.layout.GroupLayout.LEADING)
226: .add(
227: org.jdesktop.layout.GroupLayout.TRAILING,
228: layout
229: .createSequentialGroup()
230: .addContainerGap()
231: .add(
232: layout
233: .createParallelGroup(
234: org.jdesktop.layout.GroupLayout.BASELINE)
235: .add(
236: labelSprite)
237: .add(
238: textFieldSprite,
239: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
240: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
241: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
242: .addPreferredGap(
243: org.jdesktop.layout.LayoutStyle.RELATED)
244: .add(
245: panelImagePreview,
246: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
247: 213, Short.MAX_VALUE)
248: .addPreferredGap(
249: org.jdesktop.layout.LayoutStyle.RELATED)
250: .add(
251: layout
252: .createParallelGroup(
253: org.jdesktop.layout.GroupLayout.BASELINE)
254: .add(
255: labelFrames)
256: .add(
257: textFieldFrames,
258: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
259: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
260: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
261: .add(
262: textFieldDelay,
263: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
264: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
265: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
266: .add(labelDelay))
267: .addPreferredGap(
268: org.jdesktop.layout.LayoutStyle.RELATED)
269: .add(
270: layout
271: .createParallelGroup(
272: org.jdesktop.layout.GroupLayout.LEADING)
273: .add(
274: jTextField1,
275: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
276: org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
277: org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
278: .add(jLabel1))
279: .addContainerGap()));
280: }// </editor-fold>//GEN-END:initComponents
281:
282: // Variables declaration - do not modify//GEN-BEGIN:variables
283: public javax.swing.JLabel jLabel1;
284: public javax.swing.JTextField jTextField1;
285: public javax.swing.JLabel labelDelay;
286: public javax.swing.JLabel labelFrames;
287: public javax.swing.JLabel labelSprite;
288: public javax.swing.JPanel panelImagePreview;
289: public javax.swing.JTextField textFieldDelay;
290: public javax.swing.JTextField textFieldFrames;
291: public javax.swing.JTextField textFieldSprite;
292: // End of variables declaration//GEN-END:variables
293:
294: }
|