📄 preferencesdialog.java
字号:
int gridY = 0; AppConfig config = AppConfig.getInstance( ); // Label: look-and-feel JLabel lookAndFeelLabel = new FLabel( LOOK_AND_FEEL_STR ); gbc.gridx = 0; gbc.gridy = gridY; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.LINE_END; gbc.fill = GridBagConstraints.NONE; gbc.insets = AppConstants.COMPONENT_INSETS; gridBag.setConstraints( lookAndFeelLabel, gbc ); controlPanel.add( lookAndFeelLabel ); // Combo box: look-and-feel lookAndFeelComboBox = new FComboBox( ); UIManager.LookAndFeelInfo[] lookAndFeelInfos = UIManager.getInstalledLookAndFeels( ); if ( lookAndFeelInfos.length == 0 ) { lookAndFeelComboBox.addItem( NO_LOOK_AND_FEELS_STR ); lookAndFeelComboBox.setSelectedIndex( 0 ); lookAndFeelComboBox.setEnabled( false ); } else { String[] lookAndFeelNames = new String[lookAndFeelInfos.length]; for ( int i = 0; i < lookAndFeelInfos.length; ++i ) { lookAndFeelNames[i] = lookAndFeelInfos[i].getName( ); lookAndFeelComboBox.addItem( lookAndFeelNames[i] ); } lookAndFeelComboBox.setSelectedIndex( Util.getIndex( lookAndFeelNames, config.getLookAndFeel( ) ) ); } gbc.gridx = 1; gbc.gridy = gridY++; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.LINE_START; gbc.fill = GridBagConstraints.NONE; gbc.insets = AppConstants.COMPONENT_INSETS; gridBag.setConstraints( lookAndFeelComboBox, gbc ); controlPanel.add( lookAndFeelComboBox ); // Label: orientation by locale JLabel orientationByLocaleLabel = new FLabel( ORIENTATION_BY_LOCALE_STR ); gbc.gridx = 0; gbc.gridy = gridY; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.LINE_END; gbc.fill = GridBagConstraints.NONE; gbc.insets = AppConstants.COMPONENT_INSETS; gridBag.setConstraints( orientationByLocaleLabel, gbc ); controlPanel.add( orientationByLocaleLabel ); // Combo box: orientation by locale orientationByLocaleComboBox = new BooleanComboBox( config.isOrientationByLocale( ) ); gbc.gridx = 1; gbc.gridy = gridY++; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.LINE_START; gbc.fill = GridBagConstraints.NONE; gbc.insets = AppConstants.COMPONENT_INSETS; gridBag.setConstraints( orientationByLocaleComboBox, gbc ); controlPanel.add( orientationByLocaleComboBox ); // Check box: background colour backgroundColourCheckBox = new FCheckBox( BACKGROUND_COLOUR_STR ); backgroundColourCheckBox.setSelected( config.isBackgroundColour( ) ); backgroundColourCheckBox.setActionCommand( Command.ENABLE_BACKGROUND_COLOUR ); backgroundColourCheckBox.addActionListener( this ); gbc.gridx = 0; gbc.gridy = gridY; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.LINE_END; gbc.fill = GridBagConstraints.NONE; gbc.insets = AppConstants.COMPONENT_INSETS; gridBag.setConstraints( backgroundColourCheckBox, gbc ); controlPanel.add( backgroundColourCheckBox ); // Button: background colour backgroundColourButton = new PlotColourButton( config.getBackgroundColour( ) ); backgroundColourButton.setEnabled( backgroundColourCheckBox.isSelected( ) ); backgroundColourButton.setActionCommand( Command.CHOOSE_BACKGROUND_COLOUR ); backgroundColourButton.addActionListener( this ); gbc.gridx = 1; gbc.gridy = gridY++; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.LINE_START; gbc.fill = GridBagConstraints.NONE; gbc.insets = AppConstants.COMPONENT_INSETS; gridBag.setConstraints( backgroundColourButton, gbc ); controlPanel.add( backgroundColourButton ); //---- Outer panel JPanel outerPanel = new JPanel( gridBag ); outerPanel.setBorder( BorderFactory.createEmptyBorder( 2, 2, 2, 2 ) ); gbc.gridx = 0; gbc.gridy = 0; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.CENTER; gbc.fill = GridBagConstraints.NONE; gbc.insets = new Insets( 0, 0, 0, 0 ); gridBag.setConstraints( controlPanel, gbc ); outerPanel.add( controlPanel ); return outerPanel; } //------------------------------------------------------------------ private JPanel getPanelPlot( ) { //---- Control panel GridBagLayout gridBag = new GridBagLayout( ); GridBagConstraints gbc = new GridBagConstraints( ); JPanel controlPanel = new JPanel( gridBag ); GuiUtilities.setPaddedLineBorder( controlPanel ); int gridY = 0; AppConfig config = AppConfig.getInstance( ); // Label: plot size JLabel plotSizeLabel = new FLabel( PLOT_SIZE_STR ); gbc.gridx = 0; gbc.gridy = gridY; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.LINE_END; gbc.fill = GridBagConstraints.NONE; gbc.insets = AppConstants.COMPONENT_INSETS; gridBag.setConstraints( plotSizeLabel, gbc ); controlPanel.add( plotSizeLabel ); // Spinner: plot width JPanel plotSizePanel = new JPanel( gridBag ); plotWidthSpinner = new FIntegerSpinner( config.getPlotSize( ).width, PlotPanel.MIN_PLOT_WIDTH, PlotPanel.MAX_PLOT_WIDTH, PLOT_SIZE_FIELD_LENGTH ); gbc.gridx = 0; gbc.gridy = 0; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.LINE_START; gbc.fill = GridBagConstraints.NONE; gbc.insets = new Insets( 0, 0, 0, 0 ); gridBag.setConstraints( plotWidthSpinner, gbc ); plotSizePanel.add( plotWidthSpinner ); // Label: times JLabel timesLabel = new FLabel( TIMES_STR ); gbc.gridx = 1; gbc.gridy = 0; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.LINE_START; gbc.fill = GridBagConstraints.NONE; gbc.insets = new Insets( 0, 2, 0, 0 ); gridBag.setConstraints( timesLabel, gbc ); plotSizePanel.add( timesLabel ); // Spinner: plot height plotHeightSpinner = new FIntegerSpinner( config.getPlotSize( ).height, PlotPanel.MIN_PLOT_HEIGHT, PlotPanel.MAX_PLOT_HEIGHT, PLOT_SIZE_FIELD_LENGTH ); gbc.gridx = 2; gbc.gridy = 0; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.LINE_START; gbc.fill = GridBagConstraints.NONE; gbc.insets = new Insets( 0, 2, 0, 0 ); gridBag.setConstraints( plotHeightSpinner, gbc ); plotSizePanel.add( plotHeightSpinner ); gbc.gridx = 1; gbc.gridy = gridY++; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.LINE_START; gbc.fill = GridBagConstraints.NONE; gbc.insets = AppConstants.COMPONENT_INSETS; gridBag.setConstraints( plotSizePanel, gbc ); controlPanel.add( plotSizePanel ); // Label: show grid JLabel showGridLabel = new FLabel( SHOW_GRID_STR ); gbc.gridx = 0; gbc.gridy = gridY; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.LINE_END; gbc.fill = GridBagConstraints.NONE; gbc.insets = AppConstants.COMPONENT_INSETS; gridBag.setConstraints( showGridLabel, gbc ); controlPanel.add( showGridLabel ); // Combo box: show grid showGridComboBox = new BooleanComboBox( config.isPlotShowGrid( ) ); gbc.gridx = 1; gbc.gridy = gridY++; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.LINE_START; gbc.fill = GridBagConstraints.NONE; gbc.insets = AppConstants.COMPONENT_INSETS; gridBag.setConstraints( showGridComboBox, gbc ); controlPanel.add( showGridComboBox ); // Label: number of fraction digits JLabel numFractionDigitsLabel = new FLabel( NUM_FRACTION_DIGITS_STR ); gbc.gridx = 0; gbc.gridy = gridY; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.LINE_END; gbc.fill = GridBagConstraints.NONE; gbc.insets = AppConstants.COMPONENT_INSETS; gridBag.setConstraints( numFractionDigitsLabel, gbc ); controlPanel.add( numFractionDigitsLabel ); // Spinner: number of fraction digits numFractionDigitsSpinner = new FIntegerSpinner( config.getPlotNumFractionDigits( ), AppConfig.MIN_NUM_FRACTION_DIGITS, AppConfig.MAX_NUM_FRACTION_DIGITS, NUM_FRACTION_DIGITS_FIELD_LENGTH ); gbc.gridx = 1; gbc.gridy = gridY++; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.LINE_START; gbc.fill = GridBagConstraints.NONE; gbc.insets = AppConstants.COMPONENT_INSETS; gridBag.setConstraints( numFractionDigitsSpinner, gbc ); controlPanel.add( numFractionDigitsSpinner ); // Label: fixed-point exponent range JLabel fixedPointRangeLabel = new FLabel( FIXED_POINT_EXPONENT_RANGE_STR ); gbc.gridx = 0; gbc.gridy = gridY; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.LINE_END; gbc.fill = GridBagConstraints.NONE; gbc.insets = AppConstants.COMPONENT_INSETS; gridBag.setConstraints( fixedPointRangeLabel, gbc ); controlPanel.add( fixedPointRangeLabel ); // Spinner: fixed-point exponent lower limit JPanel fixedPointRangePanel = new JPanel( gridBag ); fixedPointLowerLimitSpinner = new FIntegerSpinner( config.getPlotFixedPointExponentRange( ).lowerLimit, AppConfig.MIN_FIXED_POINT_EXPONENT_LIMIT, AppConfig.MAX_FIXED_POINT_EXPONENT_LIMIT, FIXED_POINT_RANGE_FIELD_LENGTH, true ); gbc.gridx = 0; gbc.gridy = 0; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.LINE_START; gbc.fill = GridBagConstraints.NONE; gbc.insets = new Insets( 0, 0, 0, 0 ); gridBag.setConstraints( fixedPointLowerLimitSpinner, gbc ); fixedPointRangePanel.add( fixedPointLowerLimitSpinner ); // Label: to JLabel toLabel = new FLabel( TO_STR ); gbc.gridx = 1; gbc.gridy = 0; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.LINE_START; gbc.fill = GridBagConstraints.NONE; gbc.insets = new Insets( 0, 4, 0, 0 ); gridBag.setConstraints( toLabel, gbc ); fixedPointRangePanel.add( toLabel ); // Spinner: fixed-point exponent upper limit fixedPointUpperLimitSpinner = new FIntegerSpinner( config.getPlotFixedPointExponentRange( ).upperLimit, AppConfig.MIN_FIXED_POINT_EXPONENT_LIMIT, AppConfig.MAX_FIXED_POINT_EXPONENT_LIMIT, FIXED_POINT_RANGE_FIELD_LENGTH, true );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -