/** * Returns the font that is associated with the editor of this date picker. */ @Override public Font getFont() { return getEditor().getFont(); }
@Override public int getBaseline(int width, int height) { JFormattedTextField editor = datePicker.getEditor(); View rootView = editor.getUI().getRootView(editor); if (rootView.getViewCount() > 0) { Insets insets = editor.getInsets(); Insets insetsOut = datePicker.getInsets(); int nh = height - insets.top - insets.bottom - insetsOut.top - insetsOut.bottom; int y = insets.top + insetsOut.top; View fieldView = rootView.getView(0); int vspan = (int) fieldView.getPreferredSpan(View.Y_AXIS); if (nh != vspan) { int slop = nh - vspan; y += slop / 2; } FontMetrics fm = editor.getFontMetrics(editor.getFont()); y += fm.getAscent(); return y; } return -1; }
@Override public int getBaseline(int width, int height) { JFormattedTextField editor = datePicker.getEditor(); View rootView = editor.getUI().getRootView(editor); if (rootView.getViewCount() > 0) { Insets insets = editor.getInsets(); Insets insetsOut = datePicker.getInsets(); int nh = height - insets.top - insets.bottom - insetsOut.top - insetsOut.bottom; int y = insets.top + insetsOut.top; View fieldView = rootView.getView(0); int vspan = (int) fieldView.getPreferredSpan(View.Y_AXIS); if (nh != vspan) { int slop = nh - vspan; y += slop / 2; } FontMetrics fm = editor.getFontMetrics(editor.getFont()); y += fm.getAscent(); return y; } return -1; }
/** * Returns the font that is associated with the editor of this date picker. */ @Override public Font getFont() { return getEditor().getFont(); }
@Override public int getBaseline(int width, int height) { JFormattedTextField editor = datePicker.getEditor(); View rootView = editor.getUI().getRootView(editor); if (rootView.getViewCount() > 0) { Insets insets = editor.getInsets(); Insets insetsOut = datePicker.getInsets(); int nh = height - insets.top - insets.bottom - insetsOut.top - insetsOut.bottom; int y = insets.top + insetsOut.top; View fieldView = rootView.getView(0); int vspan = (int) fieldView.getPreferredSpan(View.Y_AXIS); if (nh != vspan) { int slop = nh - vspan; y += slop / 2; } FontMetrics fm = editor.getFontMetrics(editor.getFont()); y += fm.getAscent(); return y; } return -1; }
/** * Returns the font that is associated with the editor of this date picker. */ @Override public Font getFont() { return getEditor().getFont(); }
@Override public int getBaseline(int width, int height) { JFormattedTextField editor = datePicker.getEditor(); View rootView = editor.getUI().getRootView(editor); if (rootView.getViewCount() > 0) { Insets insets = editor.getInsets(); Insets insetsOut = datePicker.getInsets(); int nh = height - insets.top - insets.bottom - insetsOut.top - insetsOut.bottom; int y = insets.top + insetsOut.top; View fieldView = rootView.getView(0); int vspan = (int) fieldView.getPreferredSpan(View.Y_AXIS); if (nh != vspan) { int slop = nh - vspan; y += slop / 2; } FontMetrics fm = editor.getFontMetrics(editor.getFont()); y += fm.getAscent(); return y; } return -1; }
/** * Returns the font that is associated with the editor of this date picker. */ @Override public Font getFont() { return getEditor().getFont(); }
@Override public int getBaseline(int width, int height) { JFormattedTextField editor = datePicker.getEditor(); View rootView = editor.getUI().getRootView(editor); if (rootView.getViewCount() > 0) { Insets insets = editor.getInsets(); Insets insetsOut = datePicker.getInsets(); int nh = height - insets.top - insets.bottom - insetsOut.top - insetsOut.bottom; int y = insets.top + insetsOut.top; View fieldView = rootView.getView(0); int vspan = (int) fieldView.getPreferredSpan(View.Y_AXIS); if (nh != vspan) { int slop = nh - vspan; y += slop / 2; } FontMetrics fm = editor.getFontMetrics(editor.getFont()); y += fm.getAscent(); return y; } return -1; }
/** * Returns the font that is associated with the editor of this date picker. */ @Override public Font getFont() { return getEditor().getFont(); }
public void setModel(SpinnerModel model) { Font font = ((JSpinner.DefaultEditor) getEditor()).getTextField().getFont(); String accessibleName = ((JSpinner.DefaultEditor) getEditor()).getTextField().getAccessibleContext().getAccessibleName(); String accessibleDescription = ((JSpinner.DefaultEditor) getEditor()).getTextField().getAccessibleContext() .getAccessibleDescription(); super.setModel(model); ((JSpinner.DefaultEditor) getEditor()).getTextField().setFont(font); ((JSpinner.DefaultEditor) getEditor()).getTextField().getAccessibleContext().setAccessibleName(accessibleName); ((JSpinner.DefaultEditor) getEditor()).getTextField().getAccessibleContext() .setAccessibleDescription(accessibleDescription); }