/** * {@inheritDoc} */ @Override public Dimension getPreferredSize(JComponent c) { Dimension dim = getEditorPreferredSize(); if (popupButton != null) { dim.width += popupButton.getPreferredSize().width; } Insets insets = datePicker.getInsets(); dim.width += insets.left + insets.right; dim.height += insets.top + insets.bottom; return (Dimension)dim.clone(); }
/** * {@inheritDoc} */ @Override public Dimension getPreferredSize(JComponent c) { Dimension dim = datePicker.getEditor().getPreferredSize(); if (popupButton != null) { dim.width += popupButton.getPreferredSize().width; } Insets insets = datePicker.getInsets(); dim.width += insets.left + insets.right; dim.height += insets.top + insets.bottom; return (Dimension)dim.clone(); }
/** * {@inheritDoc} */ @Override public Dimension getPreferredSize(JComponent c) { Dimension dim = datePicker.getEditor().getPreferredSize(); if (popupButton != null) { dim.width += popupButton.getPreferredSize().width; } Insets insets = datePicker.getInsets(); dim.width += insets.left + insets.right; dim.height += insets.top + insets.bottom; return (Dimension)dim.clone(); }
/** * {@inheritDoc} */ @Override public Dimension getPreferredSize(JComponent c) { Dimension dim = datePicker.getEditor().getPreferredSize(); if (popupButton != null) { dim.width += popupButton.getPreferredSize().width; } Insets insets = datePicker.getInsets(); dim.width += insets.left + insets.right; dim.height += insets.top + insets.bottom; return (Dimension)dim.clone(); }
/** * {@inheritDoc} */ @Override public Dimension getPreferredSize(JComponent c) { Dimension dim = datePicker.getEditor().getPreferredSize(); if (popupButton != null) { dim.width += popupButton.getPreferredSize().width; } Insets insets = datePicker.getInsets(); dim.width += insets.left + insets.right; dim.height += insets.top + insets.bottom; return (Dimension)dim.clone(); }
@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; }
@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; }
@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; }
public void layoutContainer(Container parent) { Insets insets = datePicker.getInsets(); int width = datePicker.getWidth() - insets.left - insets.right; int height = datePicker.getHeight() - insets.top - insets.bottom; int popupButtonWidth = popupButton != null ? popupButton.getPreferredSize().width : 0; boolean ltr = datePicker.getComponentOrientation().isLeftToRight(); datePicker.getEditor().setBounds(ltr ? insets.left : insets.left + popupButtonWidth, insets.top, width - popupButtonWidth, height); if (popupButton != null) { popupButton.setBounds(ltr ? width - popupButtonWidth + insets.left : insets.left, insets.top, popupButtonWidth, height); } }
@Override public void layoutContainer(Container parent) { Insets insets = datePicker.getInsets(); int width = datePicker.getWidth() - insets.left - insets.right; int height = datePicker.getHeight() - insets.top - insets.bottom; int popupButtonWidth = popupButton != null ? popupButton.getPreferredSize().width : 0; boolean ltr = datePicker.getComponentOrientation().isLeftToRight(); datePicker.getEditor().setBounds(ltr ? insets.left : insets.left + popupButtonWidth, insets.top, width - popupButtonWidth, height); if (popupButton != null) { popupButton.setBounds(ltr ? width - popupButtonWidth + insets.left : insets.left, insets.top, popupButtonWidth, height); } }
@Override public void layoutContainer(Container parent) { Insets insets = datePicker.getInsets(); int width = datePicker.getWidth() - insets.left - insets.right; int height = datePicker.getHeight() - insets.top - insets.bottom; int popupButtonWidth = popupButton != null ? popupButton.getPreferredSize().width : 0; boolean ltr = datePicker.getComponentOrientation().isLeftToRight(); datePicker.getEditor().setBounds(ltr ? insets.left : insets.left + popupButtonWidth, insets.top, width - popupButtonWidth, height); if (popupButton != null) { popupButton.setBounds(ltr ? width - popupButtonWidth + insets.left : insets.left, insets.top, popupButtonWidth, height); } }
@Override public void layoutContainer(Container parent) { Insets insets = datePicker.getInsets(); int width = datePicker.getWidth() - insets.left - insets.right; int height = datePicker.getHeight() - insets.top - insets.bottom; int popupButtonWidth = popupButton != null ? popupButton.getPreferredSize().width : 0; boolean ltr = datePicker.getComponentOrientation().isLeftToRight(); datePicker.getEditor().setBounds(ltr ? insets.left : insets.left + popupButtonWidth, insets.top, width - popupButtonWidth, height); if (popupButton != null) { popupButton.setBounds(ltr ? width - popupButtonWidth + insets.left : insets.left, insets.top, popupButtonWidth, height); } }
@Override public void layoutContainer(Container parent) { Insets insets = datePicker.getInsets(); int width = datePicker.getWidth() - insets.left - insets.right; int height = datePicker.getHeight() - insets.top - insets.bottom; int popupButtonWidth = popupButton != null ? popupButton.getPreferredSize().width : 0; boolean ltr = datePicker.getComponentOrientation().isLeftToRight(); datePicker.getEditor().setBounds(ltr ? insets.left : insets.left + popupButtonWidth, insets.top, width - popupButtonWidth, height); if (popupButton != null) { popupButton.setBounds(ltr ? width - popupButtonWidth + insets.left : insets.left, insets.top, popupButtonWidth, height); } }