Skip to content

Commit 87beac6

Browse files
author
mpschr
committed
large bookmark
1 parent 743bd3b commit 87beac6

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

org.gitools.ui.app/src/main/java/org/gitools/ui/app/actions/BookmarksDropdown.form

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</properties>
1212
<border type="none"/>
1313
<children>
14-
<component id="8fe54" class="javax.swing.JComboBox" binding="bookmarkComboBox">
14+
<component id="8fe54" class="org.gitools.ui.app.actions.BookmarksDropdown$WideComboBox" binding="bookmarkComboBox">
1515
<constraints>
1616
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
1717
<forms top="0" left="5" bottom="0" right="5"/>

org.gitools.ui.app/src/main/java/org/gitools/ui/app/actions/BookmarksDropdown.java

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,14 @@
4444
import java.awt.event.MouseEvent;
4545
import java.beans.PropertyChangeEvent;
4646
import java.beans.PropertyChangeListener;
47+
import java.util.Vector;
4748

4849

4950
//FIXME: always two listeners.
5051

5152
public class BookmarksDropdown extends HeatmapAction implements IPanelAction, PropertyChangeListener {
5253

53-
private JComboBox<Bookmark> bookmarkComboBox;
54+
private WideComboBox<Bookmark> bookmarkComboBox;
5455
private JPanel bookmarksSelectPanel;
5556
private Bookmarks bookmarks;
5657
private static Bookmark NO_OPTION = new Bookmark();
@@ -234,5 +235,40 @@ public void mousePressed(MouseEvent e) {
234235
}
235236
}
236237

238+
public static class WideComboBox<E> extends JComboBox<E> {
239+
240+
public WideComboBox() {
241+
}
242+
243+
public WideComboBox(final E items[]) {
244+
super(items);
245+
}
246+
247+
public WideComboBox(Vector items) {
248+
super(items);
249+
}
250+
251+
public WideComboBox(ComboBoxModel aModel) {
252+
super(aModel);
253+
}
254+
255+
private boolean layingOut = false;
256+
257+
public void doLayout() {
258+
try {
259+
layingOut = true;
260+
super.doLayout();
261+
} finally {
262+
layingOut = false;
263+
}
264+
}
265+
266+
public Dimension getSize() {
267+
Dimension dim = super.getSize();
268+
if (!layingOut)
269+
dim.width = Math.max(dim.width, getPreferredSize().width);
270+
return dim;
271+
}
272+
}
237273
}
238274

0 commit comments

Comments
 (0)