|
|
|
@ -4,11 +4,15 @@ import com.fr.base.BaseUtils;
|
|
|
|
|
import com.fr.design.constants.LayoutConstants; |
|
|
|
|
import com.fr.design.gui.ibutton.UIToggleButton; |
|
|
|
|
import com.fr.design.gui.icombobox.UIComboBox; |
|
|
|
|
import com.fr.design.gui.icombobox.UIComboBoxRenderer; |
|
|
|
|
import com.fr.design.i18n.Toolkit; |
|
|
|
|
import com.fr.design.utils.gui.GUICoreUtils; |
|
|
|
|
import com.fr.general.FRFont; |
|
|
|
|
import com.fr.stable.Constants; |
|
|
|
|
|
|
|
|
|
import javax.swing.DefaultComboBoxModel; |
|
|
|
|
import javax.swing.JLabel; |
|
|
|
|
import javax.swing.JList; |
|
|
|
|
import javax.swing.JPanel; |
|
|
|
|
import java.awt.BorderLayout; |
|
|
|
|
import java.awt.Color; |
|
|
|
@ -19,12 +23,14 @@ import java.awt.Font;
|
|
|
|
|
import java.util.Vector; |
|
|
|
|
|
|
|
|
|
public class MobileStyleFontConfigPane extends JPanel { |
|
|
|
|
public static final int FONT_NONE = 0; |
|
|
|
|
private static final int MAX_FONT_SIZE = 18; |
|
|
|
|
private static final int MIN_FONT_SIZE = 12; |
|
|
|
|
private static final Dimension BUTTON_SIZE = new Dimension(20, 18); |
|
|
|
|
|
|
|
|
|
public static Vector<Integer> getFontSizes() { |
|
|
|
|
Vector<Integer> FONT_SIZES = new Vector<Integer>(); |
|
|
|
|
FONT_SIZES.add(FONT_NONE); |
|
|
|
|
for (int i = MIN_FONT_SIZE; i <= MAX_FONT_SIZE; i++) { |
|
|
|
|
FONT_SIZES.add(i); |
|
|
|
|
} |
|
|
|
@ -42,10 +48,11 @@ public class MobileStyleFontConfigPane extends JPanel {
|
|
|
|
|
|
|
|
|
|
private void initComponent() { |
|
|
|
|
|
|
|
|
|
fontSizeComboBox = new UIComboBox(getFontSizes()); |
|
|
|
|
fontSizeComboBox.setSelectedItem(16); |
|
|
|
|
fontSizeComboBox = new UIComboBox(); |
|
|
|
|
fontSizeComboBox.setSelectedItem(0); |
|
|
|
|
fontSizeComboBox.setModel(new DefaultComboBoxModel(getFontSizes())); |
|
|
|
|
fontSizeComboBox.setPreferredSize(new Dimension(60, 20)); |
|
|
|
|
fontSizeComboBox.setEditable(true); |
|
|
|
|
fontSizeComboBox.setRenderer(new LineCellRenderer()); |
|
|
|
|
underline = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/underline.png")); |
|
|
|
|
italic = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png")); |
|
|
|
|
bold = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png")); |
|
|
|
@ -96,4 +103,20 @@ public class MobileStyleFontConfigPane extends JPanel {
|
|
|
|
|
underline.isSelected() ? Constants.LINE_THIN : Constants.LINE_NONE |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private class LineCellRenderer extends UIComboBoxRenderer { |
|
|
|
|
public LineCellRenderer() { |
|
|
|
|
super(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { |
|
|
|
|
JLabel renderer =(JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); |
|
|
|
|
int currentValue = ((Integer) value).intValue(); |
|
|
|
|
if (currentValue == MobileStyleFontConfigPane.FONT_NONE) { |
|
|
|
|
renderer.setText(" " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_None")); |
|
|
|
|
} |
|
|
|
|
return renderer; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|