Rev 846 |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
/*
* Copyright (C) 2007 Steve Ratcliffe
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program 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.
*
*
* Author: Steve Ratcliffe
* Create date: 13-Oct-2007
*/
package uk.me.parabola.mkgmap.gui;
import java.awt.*;
import java.util.ResourceBundle;
import javax.swing.*;
/**
* @author Steve Ratcliffe
*/
public class FileOptions
{
private JPanel panel1
;
private JTextField description
;
private JRadioButton ASCIIRadioButton
;
private JRadioButton latin1RadioButton
;
{
// GUI initializer generated by IntelliJ IDEA GUI Designer
// >>> IMPORTANT!! <<<
// DO NOT EDIT OR ADD ANY CODE HERE!
$$$setupUI$$$
();
}
/**
* Method generated by IntelliJ IDEA GUI Designer >>> IMPORTANT!! <<< DO NOT
* edit this method OR call it in your code!
*
* @noinspection ALL
*/
private void $$$setupUI$$$
() {
panel1 =
new JPanel();
panel1.
setLayout(new GridBagLayout());
panel1.
setBorder(BorderFactory.
createTitledBorder(BorderFactory.
createLineBorder(Color.
black),
"Options for this file"));
final JLabel label1 =
new JLabel();
this.$$$loadLabelText$$$
(label1,
ResourceBundle.
getBundle("uk/me/parabola/mkgmap/gui/FileOptions").
getString("label.description"));
GridBagConstraints gbc
;
gbc =
new GridBagConstraints();
gbc.
gridx =
0;
gbc.
gridy =
0;
gbc.
anchor =
GridBagConstraints.
WEST;
gbc.
ipadx =
5;
panel1.
add(label1, gbc
);
description =
new JTextField();
description.
setColumns(0);
gbc =
new GridBagConstraints();
gbc.
gridx =
2;
gbc.
gridy =
0;
gbc.
gridwidth =
3;
gbc.
weightx =
0.9;
gbc.
anchor =
GridBagConstraints.
WEST;
gbc.
fill =
GridBagConstraints.
HORIZONTAL;
panel1.
add(description, gbc
);
final JPanel spacer1 =
new JPanel();
gbc =
new GridBagConstraints();
gbc.
gridx =
1;
gbc.
gridy =
0;
gbc.
fill =
GridBagConstraints.
HORIZONTAL;
panel1.
add(spacer1, gbc
);
ASCIIRadioButton =
new JRadioButton();
ASCIIRadioButton.
setText("ASCII");
ASCIIRadioButton.
setMnemonic('A');
ASCIIRadioButton.
setDisplayedMnemonicIndex(0);
gbc =
new GridBagConstraints();
gbc.
gridx =
4;
gbc.
gridy =
1;
gbc.
anchor =
GridBagConstraints.
WEST;
panel1.
add(ASCIIRadioButton, gbc
);
latin1RadioButton =
new JRadioButton();
latin1RadioButton.
setText("Latin1");
latin1RadioButton.
setMnemonic('L');
latin1RadioButton.
setDisplayedMnemonicIndex(0);
gbc =
new GridBagConstraints();
gbc.
gridx =
4;
gbc.
gridy =
2;
gbc.
anchor =
GridBagConstraints.
WEST;
panel1.
add(latin1RadioButton, gbc
);
final JLabel label2 =
new JLabel();
label2.
setText("Characeter Set");
gbc =
new GridBagConstraints();
gbc.
gridx =
0;
gbc.
gridy =
1;
gbc.
anchor =
GridBagConstraints.
WEST;
panel1.
add(label2, gbc
);
ButtonGroup buttonGroup
;
buttonGroup =
new ButtonGroup();
buttonGroup.
add(latin1RadioButton
);
buttonGroup.
add(latin1RadioButton
);
buttonGroup.
add(ASCIIRadioButton
);
}
/**
* @noinspection ALL
*/
private void $$$loadLabelText$$$
(JLabel component,
String text
) {
StringBuffer result =
new StringBuffer();
boolean haveMnemonic =
false;
char mnemonic =
'\0';
int mnemonicIndex = -
1;
for (int i =
0; i
< text.
length(); i++
) {
if (text.
charAt(i
) ==
'&') {
i++
;
if (i == text.
length()) break;
if (!haveMnemonic
&& text.
charAt(i
) !=
'&') {
haveMnemonic =
true;
mnemonic = text.
charAt(i
);
mnemonicIndex = result.
length();
}
}
result.
append(text.
charAt(i
));
}
component.
setText(result.
toString());
if (haveMnemonic
) {
component.
setDisplayedMnemonic(mnemonic
);
component.
setDisplayedMnemonicIndex(mnemonicIndex
);
}
}
/**
* @noinspection ALL
*/
public JComponent $$$getRootComponent$$$
() {
return panel1
;
}
}