📄 reportpropertiesframe.java
字号:
}//GEN-LAST:event_jNumberFieldBottomMarginActionPerformed
private void jNumberFieldTopMarginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jNumberFieldTopMarginActionPerformed
topMargin = (int)Unit.convertToPixels(this.jNumberFieldTopMargin.getValue(),this.getConversionUnit(jComboBoxTopMarginUnit));
}//GEN-LAST:event_jNumberFieldTopMarginActionPerformed
private void jComboBoxHUnitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxHUnitActionPerformed
this.adjustValue(jComboBoxHUnit,jNumberFieldHeight, this.getReportHeight());
}//GEN-LAST:event_jComboBoxHUnitActionPerformed
private void jNumberFieldHeightActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jNumberFieldHeightActionPerformed
this.jComboBoxSize.setSelectedItem("Custom");
reportHeight = (int)Unit.convertToPixels(this.jNumberFieldHeight.getValue(),this.getConversionUnit(jComboBoxHUnit));
adjustOrientation();
}//GEN-LAST:event_jNumberFieldHeightActionPerformed
private void jNumberFieldWidthActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jNumberFieldWidthActionPerformed
this.jComboBoxSize.setSelectedItem("Custom");
reportWidth = (int)Unit.convertToPixels(this.jNumberFieldWidth.getValue(),this.getConversionUnit(jComboBoxWUnit));
adjustOrientation();
}//GEN-LAST:event_jNumberFieldWidthActionPerformed
private void jComboBoxWUnitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxWUnitActionPerformed
this.adjustValue(jComboBoxWUnit,jNumberFieldWidth, this.getReportWidth());
}//GEN-LAST:event_jComboBoxWUnitActionPerformed
private void jCheckBoxTitleOnNewPageActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxTitleOnNewPageActionPerformed
this.titleOnNewPage = jCheckBoxTitleOnNewPage.isSelected();
}//GEN-LAST:event_jCheckBoxTitleOnNewPageActionPerformed
private void jButtonOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonOKActionPerformed
this.reportName = jTextFieldName.getText();
this.scriptletClass = jTextFieldScriptletClass.getText();
this.setResourceBundleBaseName(jTextFieldResourceBundleBaseName.getText());
//System.out.println("Il nome :"+this.getReportName());
this.setDialogResult( JOptionPane.OK_OPTION );
this.setVisible(false);
//this.dispose();
}//GEN-LAST:event_jButtonOKActionPerformed
private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
}//GEN-LAST:event_formWindowOpened
private void jButtonCANCELActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCANCELActionPerformed
this.setDialogResult( JOptionPane.CANCEL_OPTION );
this.dispose();
}//GEN-LAST:event_jButtonCANCELActionPerformed
/** Exit the Application */
private void exitForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm
this.setDialogResult( JOptionPane.CLOSED_OPTION );
this.dispose();
}//GEN-LAST:event_exitForm
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
new ReportPropertiesFrame(null,true).show();
}
/** Getter for property dialogResult.
* @return Value of property dialogResult.
*
*/
public int getDialogResult() {
return this.dialogResult;
}
/** Setter for property dialogResult.
* @param dialogResult New value of property dialogResult.
*
*/
public void setDialogResult(int dialogResult) {
this.dialogResult = dialogResult;
}
/**
* This method convert the old value in new value according with the Unit selected
*/
public void adjustValue(javax.swing.JComboBox unitCombo, JNumberField numberField, int store_value) {
try {
if (unitCombo.getSelectedIndex() == 0) {
numberField.setDecimals(0);
numberField.setInteger(true);
numberField.setValue(store_value);
}
else if (unitCombo.getSelectedIndex() == 1) {
numberField.setDecimals(3);
numberField.setInteger(false);
numberField.setValue( Unit.convertPixelsToInches(store_value) );
}
else if (unitCombo.getSelectedIndex() == 2) {
numberField.setDecimals(3);
numberField.setInteger(false);
numberField.setValue( Unit.convertPixelsToCentimeters( store_value) );
}
else if (unitCombo.getSelectedIndex() == 3) {
numberField.setDecimals(3);
numberField.setInteger(false);
numberField.setValue( Unit.convertPixelsToMillimeters( store_value) );
}
} catch (Exception ex) {}
}
private double getConversionUnit(javax.swing.JComboBox comboBox) {
double convert = 1.0;
if (comboBox.getSelectedIndex() == 1) convert = Unit.INCHES;
else if (comboBox.getSelectedIndex() == 2) convert = Unit.CENTIMETERS;
else if (comboBox.getSelectedIndex() == 3) convert = Unit.MILLIMETERS;
return convert;
}
/** Getter for property reportHeight.
* @return Value of property reportHeight.
*
*/
public int getReportHeight() {
return reportHeight;
}
/** Setter for property reportHeight.
* @param reportHeight New value of property reportHeight.
*
*/
public void setReportHeight(int reportHeight) {
this.reportHeight = reportHeight;
jComboBoxHUnitActionPerformed(new java.awt.event.ActionEvent(jComboBoxHUnit,0,""));
}
/** Getter for property reportWidth.
* @return Value of property reportWidth.
*
*/
public int getReportWidth() {
return reportWidth;
}
/** Setter for property reportWidth.
* @param reportWidth New value of property reportWidth.
*
*/
public void setReportWidth(int reportWidth) {
this.reportWidth = reportWidth;
jComboBoxWUnitActionPerformed(new java.awt.event.ActionEvent(jComboBoxWUnit,0,""));
}
/** Getter for property rightMargin.
* @return Value of property rightMargin.
*
*/
public int getRightMargin() {
return rightMargin;
}
/** Setter for property rightMargin.
* @param rightMargin New value of property rightMargin.
*
*/
public void setRightMargin(int rightMargin) {
this.rightMargin = rightMargin;
jComboBoxRightMarginUnitActionPerformed(new java.awt.event.ActionEvent(jComboBoxRightMarginUnit,0,""));
}
/** Getter for property topMargin.
* @return Value of property topMargin.
*
*/
public int getTopMargin() {
return topMargin;
}
/** Setter for property topMargin.
* @param topMargin New value of property topMargin.
*
*/
public void setTopMargin(int topMargin) {
this.topMargin = topMargin;
jComboBoxTopMarginUnitActionPerformed(new java.awt.event.ActionEvent(jComboBoxTopMarginUnit,0,""));
}
/** Getter for property leftMargin.
* @return Value of property leftMargin.
*
*/
public int getLeftMargin() {
return leftMargin;
}
/** Setter for property leftMargin.
* @param leftMargin New value of property leftMargin.
*
*/
public void setLeftMargin(int leftMargin) {
this.leftMargin = leftMargin;
jComboBoxLeftMarginUnitActionPerformed(new java.awt.event.ActionEvent(jComboBoxLeftMarginUnit,0,""));
}
/** Getter for property bottomMargin.
* @return Value of property bottomMargin.
*
*/
public int getBottomMargin() {
return bottomMargin;
}
/** Setter for property bottomMargin.
* @param bottomMargin New value of property bottomMargin.
*
*/
public void setBottomMargin(int bottomMargin) {
this.bottomMargin = bottomMargin;
jComboBoxBottomMarginUnitActionPerformed(new java.awt.event.ActionEvent(jComboBoxBottomMarginUnit,0,""));
}
/** Getter for property orientation.
* @return Value of property orientation.
*
*/
public java.lang.String getOrientation() {
return orientation;
}
/** Setter for property orientation.
* @param orientation New value of property orientation.
*
*/
public void setOrientation(java.lang.String orientation) {
jComboBoxOrientation.setSelectedItem(orientation);
this.orientation = orientation;
}
/** Getter for property scriptletClass.
* @return Value of property scriptletClass.
*
*/
public java.lang.String getScriptletClass() {
return scriptletClass;
}
/** Setter for property scriptletClass.
* @param scriptletClass New value of property scriptletClass.
*
*/
public void setScriptletClass(java.lang.String scriptletClass) {
jTextFieldScriptletClass.setText(Misc.nvl(scriptletClass,""));
this.scriptletClass = scriptletClass;
}
/** Getter for property reportName.
* @return Value of property reportName.
*
*/
public java.lang.String getReportName() {
return reportName;
}
/** Setter for property reportName.
* @param reportName New value of property reportName.
*
*/
public void setReportName(java.lang.String reportName) {
this.reportName = reportName;
this.jTextFieldName.setText(reportName);
}
/** Getter for property columns.
* @return Value of property columns.
*
*/
public int getColumns() {
return columns;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -