You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
106 lines
3.3 KiB
106 lines
3.3 KiB
package com.fr.design.style; |
|
|
|
|
|
import javax.swing.Box; |
|
import javax.swing.JList; |
|
import javax.swing.JPanel; |
|
import javax.swing.event.ListSelectionEvent; |
|
import javax.swing.event.ListSelectionListener; |
|
|
|
import com.fr.design.gui.itextfield.UINumberField; |
|
import com.fr.design.gui.itextfield.UITextField; |
|
import com.fr.design.layout.FRGUIPaneFactory; |
|
import com.fr.general.FRFont; |
|
|
|
import com.fr.design.utils.gui.GUICoreUtils; |
|
|
|
public class FontSizeStylePane extends JPanel { |
|
|
|
private UINumberField sizeField; |
|
private JList sizeList; |
|
private UITextField styleField; |
|
private JList styleList; |
|
|
|
public FontSizeStylePane() { |
|
this.init(); |
|
} |
|
|
|
private void init() { |
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
|
|
JPanel fontVSizPane = FRGUIPaneFactory.createX_AXISBoxInnerContainer_S_Pane(); |
|
this.add(fontVSizPane); |
|
|
|
// fontVSizPane.setLayout(new BoxLayout(fontVSizPane, BoxLayout.X_AXIS)); |
|
fontVSizPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Font_Size"), null)); |
|
|
|
String[] styles = { |
|
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Font_Plain"), |
|
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Font_Bold"), |
|
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Font_Italic"), |
|
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Font_Bold_Italic")}; |
|
|
|
styleField = new UITextField(); |
|
styleField.setEditable(false); |
|
|
|
styleList = new JList(styles); |
|
styleList.setVisibleRowCount(4); |
|
|
|
JPanel stylePanel = FRFontPane.createTextFieldListPane("", styleField, styleList); |
|
fontVSizPane.add(stylePanel); |
|
|
|
fontVSizPane.add(Box.createHorizontalStrut(6)); |
|
|
|
JPanel sizePanel = FRFontPane.createTextFieldListPane("", sizeField = new UINumberField(), sizeList = new JList(FRFontPane.Font_Sizes)); |
|
sizeField.setMaxDecimalLength(1); |
|
|
|
sizeField.setEditable(false); |
|
|
|
sizeList.setVisibleRowCount(4); |
|
|
|
fontVSizPane.add(sizePanel); |
|
|
|
styleField.setText((String) styleList.getSelectedValue()); |
|
|
|
sizeList.addListSelectionListener(listener); |
|
styleList.addListSelectionListener(listener); |
|
|
|
} |
|
|
|
ListSelectionListener listener = new ListSelectionListener() { |
|
public void valueChanged(ListSelectionEvent evt) { |
|
Object source = evt.getSource(); |
|
if (source == getSizeList()) { |
|
Integer size = (Integer) getSizeList().getSelectedValue(); |
|
if (size != null) { |
|
getSizeField().setValue(size.intValue()); |
|
} |
|
} else if (source == getStyleList()) { |
|
String style = (String) getStyleList().getSelectedValue(); |
|
if (style != null) getStyleField().setText(style); |
|
} |
|
} |
|
}; |
|
|
|
public UINumberField getSizeField() { |
|
return sizeField; |
|
} |
|
|
|
public JList getStyleList() { |
|
return styleList; |
|
} |
|
|
|
public JList getSizeList() { |
|
return sizeList; |
|
} |
|
|
|
public UITextField getStyleField() { |
|
return styleField; |
|
} |
|
|
|
public void populate(FRFont frFont) { |
|
styleList.setSelectedIndex(frFont.getStyle()); |
|
sizeList.setSelectedValue(new Integer(frFont.getSize()), true); |
|
sizeField.setValue(frFont.getSize2D()); |
|
} |
|
}
|
|
|