mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-161524 ui: fix column width under HiDPI
* otherwise default value from TableColumn is used (75px)
* this reverts changes from 795a337
This commit is contained in:
+8
-4
@@ -194,8 +194,8 @@ public class ClasspathPanelImpl extends JPanel implements ClasspathPanel {
|
||||
}
|
||||
}
|
||||
};
|
||||
setFixedColumnWidth(ClasspathTableModel.EXPORT_COLUMN);
|
||||
setFixedColumnWidth(ClasspathTableModel.SCOPE_COLUMN); // leave space for combobox border
|
||||
setFixedColumnWidth(ClasspathTableModel.EXPORT_COLUMN, ClasspathTableModel.EXPORT_COLUMN_NAME);
|
||||
setFixedColumnWidth(ClasspathTableModel.SCOPE_COLUMN, DependencyScope.COMPILE.toString() + " "); // leave space for combobox border
|
||||
|
||||
myEntryTable.registerKeyboardAction(
|
||||
new ActionListener() {
|
||||
@@ -320,10 +320,14 @@ public class ClasspathPanelImpl extends JPanel implements ClasspathPanel {
|
||||
return getItemAt(myEntryTable.getSelectedRow());
|
||||
}
|
||||
|
||||
private void setFixedColumnWidth(final int columnIndex) {
|
||||
private void setFixedColumnWidth(final int columnIndex, String sampleText) {
|
||||
final TableColumn column = myEntryTable.getTableHeader().getColumnModel().getColumn(columnIndex);
|
||||
final FontMetrics fontMetrics = myEntryTable.getFontMetrics(myEntryTable.getFont());
|
||||
final int width = fontMetrics.stringWidth(" " + sampleText + " ") + 4;
|
||||
column.setPreferredWidth(width);
|
||||
column.setMaxWidth(width);
|
||||
|
||||
column.setResizable(false);
|
||||
column.setMaxWidth(column.getPreferredWidth());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ import java.util.List;
|
||||
* @author nik
|
||||
*/
|
||||
class ClasspathTableModel extends ListTableModel<ClasspathTableItem<?>> implements ItemRemovable {
|
||||
private static final String EXPORT_COLUMN_NAME = ProjectBundle.message("modules.order.export.export.column");
|
||||
static final String EXPORT_COLUMN_NAME = ProjectBundle.message("modules.order.export.export.column");
|
||||
private static final ColumnInfo<ClasspathTableItem<?>, Boolean> EXPORT_COLUMN_INFO = new ColumnInfo<ClasspathTableItem<?>, Boolean>(EXPORT_COLUMN_NAME) {
|
||||
@Nullable
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user