-
-
Notifications
You must be signed in to change notification settings - Fork 268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make inner classes protected... #113
Comments
another similar example would be private helper methods like FlatComboBoxUI.getDisabledBackground() which I had to re-implement in the subclass just to adopt the paint method a bit |
I'm willing to open FlatLaf as much as possible, but I'm not sure whether opening What's your use case for subclassing |
the problem here was that I use glazedlists for my tables and glazedlists needs a component which implements the interface
to achieve this without the need to copy the whole inner class. Creating sub-themes on your theme would be much easier if we could use as much code as possible ( |
Implemented a little app to test Glazed Lists with FlatLaf (in commit 212c553) and the table header sort icons work out of the box (without a custom header renderer and without Top/bottom/left positioned sort arrows did not work, but is fixed in 211030b (enable with Little "problem" is that this uses non-HiDPI icons from Glazed Lists. It is possible to replace them with Line 70 in 212c553
Is your plan/idea to use This is probably difficult because the only method of the interface is Would be easy if Glazed Lists would provide a BTW the recommended way to implement custom header renderer, which works with all look and feels, is: private static class MyHeaderRenderer implements TableCellRenderer {
private final TableCellRenderer delegate;
MyHeaderRenderer( TableCellRenderer delegate ) {
this.delegate = delegate;
}
@Override
public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column ) {
Component c = delegate.getTableCellRendererComponent( table, value, isSelected, hasFocus, row, column );
// TODO do some modifications
return c;
}
}
// install own header renderer
JTableHeader header = itemsTable.getTableHeader();
header.setDefaultRenderer( new MyHeaderRenderer( header.getDefaultRenderer() ) ); Still don't think that it is necessary to copy code from Regarding other private methods/fields/classes: I plan to review them soon and will make them protected where it may be useful... |
wow, even more that I could imagine! thanks! |
- reviewed all private methods and made them protected/public where it might be useful for subclasses - ComboBox and Spinner: added protected getBackground() and getForeground() methods to allow subclasses to change colors - TabbedPane: moved tab separator painting to own method (issue #113)
@mlaggner wrote:
I've reviewed all private methods and made them protected/public where it might be useful for subclasses in commit ea2412d. Also made some changes to |
thanks, will review my "patches" as soon as 0.37 is released. |
Did you enable table sorting? FlatLaf/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/DataComponentsPanel.java Line 296 in 368fbcd
|
Thanks you very much! I want to add an icon down on the header table bar, what should I do? |
Here is a great article that gives many details about how to sort JTable: |
... to avoid copying the whole content of the inner class when creating subclasses
e.g. where I found an example https://github.com/JFormDesigner/FlatLaf/blob/master/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTableHeaderUI.java#L255
The text was updated successfully, but these errors were encountered: