Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
65a27f3e
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
65a27f3e
编写于
7月 18, 2011
作者:
R
rupashka
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7031941: Use generificated JComboBox and JList in core libraries
Reviewed-by: alexp
上级
95fbd452
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
62 addition
and
63 deletion
+62
-63
src/share/classes/com/sun/java/swing/plaf/motif/MotifFileChooserUI.java
...ses/com/sun/java/swing/plaf/motif/MotifFileChooserUI.java
+14
-13
src/share/classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java
...com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java
+9
-8
src/share/classes/javax/swing/plaf/basic/BasicComboPopup.java
...share/classes/javax/swing/plaf/basic/BasicComboPopup.java
+1
-2
src/share/classes/javax/swing/plaf/synth/SynthComboBoxUI.java
...share/classes/javax/swing/plaf/synth/SynthComboBoxUI.java
+2
-2
src/share/classes/javax/swing/text/html/FormView.java
src/share/classes/javax/swing/text/html/FormView.java
+2
-2
src/share/classes/javax/swing/text/html/HTMLDocument.java
src/share/classes/javax/swing/text/html/HTMLDocument.java
+4
-4
src/share/classes/javax/swing/text/html/HTMLWriter.java
src/share/classes/javax/swing/text/html/HTMLWriter.java
+4
-4
src/share/classes/javax/swing/text/html/OptionComboBoxModel.java
...re/classes/javax/swing/text/html/OptionComboBoxModel.java
+1
-2
src/share/classes/javax/swing/text/html/OptionListModel.java
src/share/classes/javax/swing/text/html/OptionListModel.java
+1
-2
src/share/classes/sun/swing/FilePane.java
src/share/classes/sun/swing/FilePane.java
+2
-2
src/share/classes/sun/swing/plaf/synth/SynthFileChooserUIImpl.java
.../classes/sun/swing/plaf/synth/SynthFileChooserUIImpl.java
+22
-22
未找到文件。
src/share/classes/com/sun/java/swing/plaf/motif/MotifFileChooserUI.java
浏览文件 @
65a27f3e
...
...
@@ -49,11 +49,11 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
private
FilterComboBoxModel
filterComboBoxModel
;
protected
JList
directoryList
=
null
;
protected
JList
fileList
=
null
;
protected
JList
<
File
>
directoryList
=
null
;
protected
JList
<
File
>
fileList
=
null
;
protected
JTextField
pathField
=
null
;
protected
JComboBox
filterComboBox
=
null
;
protected
JComboBox
<
FileFilter
>
filterComboBox
=
null
;
protected
JTextField
filenameTextField
=
null
;
private
static
final
Dimension
hstrut10
=
new
Dimension
(
10
,
1
);
...
...
@@ -337,7 +337,7 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
align
(
l
);
leftPanel
.
add
(
l
);
filterComboBox
=
new
JComboBox
()
{
filterComboBox
=
new
JComboBox
<
FileFilter
>
()
{
public
Dimension
getMaximumSize
()
{
Dimension
d
=
super
.
getMaximumSize
();
d
.
height
=
getPreferredSize
().
height
;
...
...
@@ -557,7 +557,7 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
}
protected
JScrollPane
createFilesList
()
{
fileList
=
new
JList
();
fileList
=
new
JList
<
File
>
();
if
(
getFileChooser
().
isMultiSelectionEnabled
())
{
fileList
.
setSelectionMode
(
ListSelectionModel
.
MULTIPLE_INTERVAL_SELECTION
);
...
...
@@ -576,7 +576,7 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
if
(
SwingUtilities
.
isLeftMouseButton
(
e
)
&&
!
chooser
.
isMultiSelectionEnabled
())
{
int
index
=
SwingUtilities2
.
loc2IndexFileList
(
fileList
,
e
.
getPoint
());
if
(
index
>=
0
)
{
File
file
=
(
File
)
fileList
.
getModel
().
getElementAt
(
index
);
File
file
=
fileList
.
getModel
().
getElementAt
(
index
);
setFileName
(
chooser
.
getName
(
file
));
}
}
...
...
@@ -593,7 +593,7 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
}
protected
JScrollPane
createDirectoryList
()
{
directoryList
=
new
JList
();
directoryList
=
new
JList
<
File
>
();
align
(
directoryList
);
directoryList
.
setCellRenderer
(
new
DirectoryCellRenderer
());
...
...
@@ -658,7 +658,7 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
}
}
protected
class
MotifDirectoryListModel
extends
AbstractListModel
implements
ListDataListener
{
protected
class
MotifDirectoryListModel
extends
AbstractListModel
<
File
>
implements
ListDataListener
{
public
MotifDirectoryListModel
()
{
getModel
().
addListDataListener
(
this
);
}
...
...
@@ -667,7 +667,7 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
return
getModel
().
getDirectories
().
size
();
}
public
Object
getElementAt
(
int
index
)
{
public
File
getElementAt
(
int
index
)
{
return
getModel
().
getDirectories
().
elementAt
(
index
);
}
...
...
@@ -694,7 +694,7 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
}
protected
class
MotifFileListModel
extends
AbstractListModel
implements
ListDataListener
{
protected
class
MotifFileListModel
extends
AbstractListModel
<
File
>
implements
ListDataListener
{
public
MotifFileListModel
()
{
getModel
().
addListDataListener
(
this
);
}
...
...
@@ -711,7 +711,7 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
return
getModel
().
getFiles
().
indexOf
(
o
);
}
public
Object
getElementAt
(
int
index
)
{
public
File
getElementAt
(
int
index
)
{
return
getModel
().
getFiles
().
elementAt
(
index
);
}
...
...
@@ -773,7 +773,8 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
/**
* Data model for a type-face selection combo-box.
*/
protected
class
FilterComboBoxModel
extends
AbstractListModel
implements
ComboBoxModel
,
PropertyChangeListener
{
protected
class
FilterComboBoxModel
extends
AbstractListModel
<
FileFilter
>
implements
ComboBoxModel
<
FileFilter
>,
PropertyChangeListener
{
protected
FileFilter
[]
filters
;
protected
FilterComboBoxModel
()
{
super
();
...
...
@@ -826,7 +827,7 @@ public class MotifFileChooserUI extends BasicFileChooserUI {
}
}
public
Object
getElementAt
(
int
index
)
{
public
FileFilter
getElementAt
(
int
index
)
{
if
(
index
>
getSize
()
-
1
)
{
// This shouldn't happen. Try to recover gracefully.
return
getFileChooser
().
getFileFilter
();
...
...
src/share/classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java
浏览文件 @
65a27f3e
...
...
@@ -60,7 +60,7 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
private
JPanel
centerPanel
;
private
JLabel
lookInLabel
;
private
JComboBox
directoryComboBox
;
private
JComboBox
<
File
>
directoryComboBox
;
private
DirectoryComboBoxModel
directoryComboBoxModel
;
private
ActionListener
directoryComboBoxAction
=
new
DirectoryComboBoxAction
();
...
...
@@ -76,7 +76,7 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
private
JPanel
buttonPanel
;
private
JPanel
bottomPanel
;
private
JComboBox
filterComboBox
;
private
JComboBox
<
FileFilter
>
filterComboBox
;
private
static
final
Dimension
hstrut10
=
new
Dimension
(
10
,
1
);
...
...
@@ -245,7 +245,7 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
topPanel
.
add
(
Box
.
createRigidArea
(
new
Dimension
(
8
,
0
)));
// CurrentDir ComboBox
directoryComboBox
=
new
JComboBox
()
{
directoryComboBox
=
new
JComboBox
<
File
>
()
{
public
Dimension
getMinimumSize
()
{
Dimension
d
=
super
.
getMinimumSize
();
d
.
width
=
60
;
...
...
@@ -445,7 +445,7 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
filterComboBoxModel
=
createFilterComboBoxModel
();
fc
.
addPropertyChangeListener
(
filterComboBoxModel
);
filterComboBox
=
new
JComboBox
(
filterComboBoxModel
);
filterComboBox
=
new
JComboBox
<
FileFilter
>
(
filterComboBoxModel
);
ftl
.
setLabelFor
(
filterComboBox
);
filterComboBox
.
setRenderer
(
createFilterComboBoxRenderer
());
fileAndFilterPanel
.
add
(
filterComboBox
);
...
...
@@ -1032,7 +1032,7 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
/**
* Data model for a type-face selection combo-box.
*/
protected
class
DirectoryComboBoxModel
extends
AbstractListModel
implements
ComboBoxModel
{
protected
class
DirectoryComboBoxModel
extends
AbstractListModel
<
File
>
implements
ComboBoxModel
<
File
>
{
Vector
<
File
>
directories
=
new
Vector
<
File
>();
int
[]
depths
=
null
;
File
selectedDirectory
=
null
;
...
...
@@ -1149,7 +1149,7 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
return
directories
.
size
();
}
public
Object
getElementAt
(
int
index
)
{
public
File
getElementAt
(
int
index
)
{
return
directories
.
elementAt
(
index
);
}
}
...
...
@@ -1189,7 +1189,8 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
/**
* Data model for a type-face selection combo-box.
*/
protected
class
FilterComboBoxModel
extends
AbstractListModel
implements
ComboBoxModel
,
PropertyChangeListener
{
protected
class
FilterComboBoxModel
extends
AbstractListModel
<
FileFilter
>
implements
ComboBoxModel
<
FileFilter
>,
PropertyChangeListener
{
protected
FileFilter
[]
filters
;
protected
FilterComboBoxModel
()
{
super
();
...
...
@@ -1242,7 +1243,7 @@ public class WindowsFileChooserUI extends BasicFileChooserUI {
}
}
public
Object
getElementAt
(
int
index
)
{
public
FileFilter
getElementAt
(
int
index
)
{
if
(
index
>
getSize
()
-
1
)
{
// This shouldn't happen. Try to recover gracefully.
return
getFileChooser
().
getFileFilter
();
...
...
src/share/classes/javax/swing/plaf/basic/BasicComboPopup.java
浏览文件 @
65a27f3e
...
...
@@ -63,8 +63,7 @@ import java.io.Serializable;
public
class
BasicComboPopup
extends
JPopupMenu
implements
ComboPopup
{
// An empty ListMode, this is used when the UI changes to allow
// the JList to be gc'ed.
private
static
class
EmptyListModelClass
implements
ListModel
,
Serializable
{
private
static
class
EmptyListModelClass
implements
ListModel
<
Object
>,
Serializable
{
public
int
getSize
()
{
return
0
;
}
public
Object
getElementAt
(
int
index
)
{
return
null
;
}
public
void
addListDataListener
(
ListDataListener
l
)
{}
...
...
src/share/classes/javax/swing/plaf/synth/SynthComboBoxUI.java
浏览文件 @
65a27f3e
...
...
@@ -444,7 +444,7 @@ public class SynthComboBoxUI extends BasicComboBoxUI implements
* renderer installed on a Synth combo box is a JLabel. If this is changed,
* then an assert will fail in SynthFileChooserUIImpl
*/
private
class
SynthComboBoxRenderer
extends
JLabel
implements
ListCellRenderer
,
UIResource
{
private
class
SynthComboBoxRenderer
extends
JLabel
implements
ListCellRenderer
<
Object
>
,
UIResource
{
public
SynthComboBoxRenderer
()
{
super
();
setName
(
"ComboBox.renderer"
);
...
...
@@ -452,7 +452,7 @@ public class SynthComboBoxUI extends BasicComboBoxUI implements
}
@Override
public
Component
getListCellRendererComponent
(
JList
list
,
Object
value
,
public
Component
getListCellRendererComponent
(
JList
<?>
list
,
Object
value
,
int
index
,
boolean
isSelected
,
boolean
cellHasFocus
)
{
setName
(
"ComboBox.listRenderer"
);
SynthLookAndFeel
.
resetSelectedUI
();
...
...
src/share/classes/javax/swing/text/html/FormView.java
浏览文件 @
65a27f3e
...
...
@@ -725,11 +725,11 @@ public class FormView extends ComponentView implements ActionListener {
}
Object
m
=
attr
.
getAttribute
(
StyleConstants
.
ModelAttribute
);
if
(
m
instanceof
OptionListModel
)
{
OptionListModel
model
=
(
OptionListModel
)
m
;
OptionListModel
<
Option
>
model
=
(
OptionListModel
<
Option
>)
m
;
for
(
int
i
=
0
;
i
<
model
.
getSize
();
i
++)
{
if
(
model
.
isSelectedIndex
(
i
))
{
Option
option
=
(
Option
)
model
.
getElementAt
(
i
);
Option
option
=
model
.
getElementAt
(
i
);
appendBuffer
(
buffer
,
name
,
option
.
getValue
());
}
}
...
...
src/share/classes/javax/swing/text/html/HTMLDocument.java
浏览文件 @
65a27f3e
...
...
@@ -3358,13 +3358,13 @@ public class HTMLDocument extends DefaultStyledDocument {
1
);
boolean
multiple
=
attr
.
getAttribute
(
HTML
.
Attribute
.
MULTIPLE
)
!=
null
;
if
((
size
>
1
)
||
multiple
)
{
OptionListModel
m
=
new
OptionListModel
();
OptionListModel
<
Option
>
m
=
new
OptionListModel
<
Option
>
();
if
(
multiple
)
{
m
.
setSelectionMode
(
ListSelectionModel
.
MULTIPLE_INTERVAL_SELECTION
);
}
selectModel
=
m
;
}
else
{
selectModel
=
new
OptionComboBoxModel
();
selectModel
=
new
OptionComboBoxModel
<
Option
>
();
}
attr
.
addAttribute
(
StyleConstants
.
ModelAttribute
,
selectModel
);
...
...
@@ -3376,14 +3376,14 @@ public class HTMLDocument extends DefaultStyledDocument {
option
=
new
Option
(
attr
);
if
(
selectModel
instanceof
OptionListModel
)
{
OptionListModel
m
=
(
OptionListModel
)
selectModel
;
OptionListModel
<
Option
>
m
=
(
OptionListModel
<
Option
>)
selectModel
;
m
.
addElement
(
option
);
if
(
option
.
isSelected
())
{
m
.
addSelectionInterval
(
optionCount
,
optionCount
);
m
.
setInitialSelection
(
optionCount
);
}
}
else
if
(
selectModel
instanceof
OptionComboBoxModel
)
{
OptionComboBoxModel
m
=
(
OptionComboBoxModel
)
selectModel
;
OptionComboBoxModel
<
Option
>
m
=
(
OptionComboBoxModel
<
Option
>)
selectModel
;
m
.
addElement
(
option
);
if
(
option
.
isSelected
())
{
m
.
setSelectedItem
(
option
);
...
...
src/share/classes/javax/swing/text/html/HTMLWriter.java
浏览文件 @
65a27f3e
...
...
@@ -527,17 +527,17 @@ public class HTMLWriter extends AbstractWriter {
Object
model
=
attr
.
getAttribute
(
StyleConstants
.
ModelAttribute
);
incrIndent
();
if
(
model
instanceof
OptionListModel
)
{
OptionListModel
listModel
=
(
OptionListModel
)
model
;
OptionListModel
<
Option
>
listModel
=
(
OptionListModel
<
Option
>)
model
;
int
size
=
listModel
.
getSize
();
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
Option
option
=
(
Option
)
listModel
.
getElementAt
(
i
);
Option
option
=
listModel
.
getElementAt
(
i
);
writeOption
(
option
);
}
}
else
if
(
model
instanceof
OptionComboBoxModel
)
{
OptionComboBoxModel
comboBoxModel
=
(
OptionComboBoxModel
)
model
;
OptionComboBoxModel
<
Option
>
comboBoxModel
=
(
OptionComboBoxModel
<
Option
>)
model
;
int
size
=
comboBoxModel
.
getSize
();
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
Option
option
=
(
Option
)
comboBoxModel
.
getElementAt
(
i
);
Option
option
=
comboBoxModel
.
getElementAt
(
i
);
writeOption
(
option
);
}
}
...
...
src/share/classes/javax/swing/text/html/OptionComboBoxModel.java
浏览文件 @
65a27f3e
...
...
@@ -25,7 +25,6 @@
package
javax.swing.text.html
;
import
javax.swing.*
;
import
javax.swing.event.*
;
import
java.io.Serializable
;
...
...
@@ -41,7 +40,7 @@ import java.io.Serializable;
@author Sunita Mani
*/
class
OptionComboBoxModel
extends
DefaultComboBoxModel
implements
Serializable
{
class
OptionComboBoxModel
<
E
>
extends
DefaultComboBoxModel
<
E
>
implements
Serializable
{
private
Option
selectedOption
=
null
;
...
...
src/share/classes/javax/swing/text/html/OptionListModel.java
浏览文件 @
65a27f3e
...
...
@@ -26,7 +26,6 @@ package javax.swing.text.html;
import
javax.swing.*
;
import
javax.swing.event.*
;
import
java.util.EventListener
;
import
java.util.BitSet
;
import
java.io.Serializable
;
...
...
@@ -44,7 +43,7 @@ import java.io.Serializable;
@author Sunita Mani
*/
class
OptionListModel
extends
DefaultListModel
implements
ListSelectionModel
,
Serializable
{
class
OptionListModel
<
E
>
extends
DefaultListModel
<
E
>
implements
ListSelectionModel
,
Serializable
{
private
static
final
int
MIN
=
-
1
;
...
...
src/share/classes/sun/swing/FilePane.java
浏览文件 @
65a27f3e
...
...
@@ -570,7 +570,7 @@ public class FilePane extends JPanel implements PropertyChangeListener {
public
JPanel
createList
()
{
JPanel
p
=
new
JPanel
(
new
BorderLayout
());
final
JFileChooser
fileChooser
=
getFileChooser
();
final
JList
list
=
new
JList
()
{
final
JList
<
Object
>
list
=
new
JList
<
Object
>
()
{
public
int
getNextMatch
(
String
prefix
,
int
startIndex
,
Position
.
Bias
bias
)
{
ListModel
model
=
getModel
();
int
max
=
model
.
getSize
();
...
...
@@ -641,7 +641,7 @@ public class FilePane extends JPanel implements PropertyChangeListener {
/**
* This model allows for sorting JList
*/
private
class
SortableListModel
extends
AbstractListModel
private
class
SortableListModel
extends
AbstractListModel
<
Object
>
implements
TableModelListener
,
RowSorterListener
{
public
SortableListModel
()
{
...
...
src/share/classes/sun/swing/plaf/synth/SynthFileChooserUIImpl.java
浏览文件 @
65a27f3e
...
...
@@ -60,7 +60,7 @@ import sun.swing.*;
*/
public
class
SynthFileChooserUIImpl
extends
SynthFileChooserUI
{
private
JLabel
lookInLabel
;
private
JComboBox
directoryComboBox
;
private
JComboBox
<
File
>
directoryComboBox
;
private
DirectoryComboBoxModel
directoryComboBoxModel
;
private
Action
directoryComboBoxAction
=
new
DirectoryComboBoxAction
();
...
...
@@ -77,10 +77,9 @@ public class SynthFileChooserUIImpl extends SynthFileChooserUI {
private
JPanel
buttonPanel
;
private
JPanel
bottomPanel
;
private
JComboBox
filterComboBox
;
private
JComboBox
<
FileFilter
>
filterComboBox
;
private
static
final
Dimension
hstrut5
=
new
Dimension
(
5
,
1
);
private
static
final
Dimension
vstrut5
=
new
Dimension
(
1
,
5
);
private
static
final
Insets
shrinkwrap
=
new
Insets
(
0
,
0
,
0
,
0
);
...
...
@@ -217,7 +216,7 @@ public class SynthFileChooserUIImpl extends SynthFileChooserUI {
topPanel
.
add
(
lookInLabel
,
BorderLayout
.
BEFORE_LINE_BEGINS
);
// CurrentDir ComboBox
directoryComboBox
=
new
JComboBox
();
directoryComboBox
=
new
JComboBox
<
File
>
();
directoryComboBox
.
getAccessibleContext
().
setAccessibleDescription
(
lookInLabelText
);
directoryComboBox
.
putClientProperty
(
"JComboBox.isTableCellEditor"
,
Boolean
.
TRUE
);
lookInLabel
.
setLabelFor
(
directoryComboBox
);
...
...
@@ -394,7 +393,7 @@ public class SynthFileChooserUIImpl extends SynthFileChooserUI {
filterComboBoxModel
=
createFilterComboBoxModel
();
fc
.
addPropertyChangeListener
(
filterComboBoxModel
);
filterComboBox
=
new
JComboBox
(
filterComboBoxModel
);
filterComboBox
=
new
JComboBox
<
FileFilter
>
(
filterComboBoxModel
);
filterComboBox
.
getAccessibleContext
().
setAccessibleDescription
(
filesOfTypeLabelText
);
filesOfTypeLabel
.
setLabelFor
(
filterComboBox
);
filterComboBox
.
setRenderer
(
createFilterComboBoxRenderer
());
...
...
@@ -671,16 +670,16 @@ public class SynthFileChooserUIImpl extends SynthFileChooserUI {
// looking combo boxes.
// So what we do here is delegate most jobs to the "real" or original renderer,
// and simply monkey with the icon and text of the renderer.
private
class
DirectoryComboBoxRenderer
implements
ListCellRenderer
{
private
ListCellRenderer
delegate
;
private
class
DirectoryComboBoxRenderer
implements
ListCellRenderer
<
File
>
{
private
ListCellRenderer
<?
super
File
>
delegate
;
IndentIcon
ii
=
new
IndentIcon
();
private
DirectoryComboBoxRenderer
(
ListCellRenderer
delegate
)
{
private
DirectoryComboBoxRenderer
(
ListCellRenderer
<?
super
File
>
delegate
)
{
this
.
delegate
=
delegate
;
}
@Override
public
Component
getListCellRendererComponent
(
JList
list
,
Object
value
,
int
index
,
boolean
isSelected
,
boolean
cellHasFocus
)
{
public
Component
getListCellRendererComponent
(
JList
<?
extends
File
>
list
,
File
value
,
int
index
,
boolean
isSelected
,
boolean
cellHasFocus
)
{
Component
c
=
delegate
.
getListCellRendererComponent
(
list
,
value
,
index
,
isSelected
,
cellHasFocus
);
assert
c
instanceof
JLabel
;
...
...
@@ -689,9 +688,8 @@ public class SynthFileChooserUIImpl extends SynthFileChooserUI {
label
.
setText
(
""
);
return
label
;
}
File
directory
=
(
File
)
value
;
label
.
setText
(
getFileChooser
().
getName
(
directory
));
Icon
icon
=
getFileChooser
().
getIcon
(
directory
);
label
.
setText
(
getFileChooser
().
getName
(
value
));
Icon
icon
=
getFileChooser
().
getIcon
(
value
);
ii
.
icon
=
icon
;
ii
.
depth
=
directoryComboBoxModel
.
getDepth
(
index
);
label
.
setIcon
(
ii
);
...
...
@@ -736,7 +734,7 @@ public class SynthFileChooserUIImpl extends SynthFileChooserUI {
/**
* Data model for a type-face selection combo-box.
*/
protected
class
DirectoryComboBoxModel
extends
AbstractListModel
implements
ComboBoxModel
{
protected
class
DirectoryComboBoxModel
extends
AbstractListModel
<
File
>
implements
ComboBoxModel
<
File
>
{
Vector
<
File
>
directories
=
new
Vector
<
File
>();
int
[]
depths
=
null
;
File
selectedDirectory
=
null
;
...
...
@@ -857,7 +855,7 @@ public class SynthFileChooserUIImpl extends SynthFileChooserUI {
return
directories
.
size
();
}
public
Object
getElementAt
(
int
index
)
{
public
File
getElementAt
(
int
index
)
{
return
directories
.
elementAt
(
index
);
}
}
...
...
@@ -890,18 +888,19 @@ public class SynthFileChooserUIImpl extends SynthFileChooserUI {
/**
* Render different type sizes and styles.
*/
public
class
FilterComboBoxRenderer
implements
ListCellRenderer
{
private
ListCellRenderer
delegate
;
private
FilterComboBoxRenderer
(
ListCellRenderer
delegate
)
{
public
class
FilterComboBoxRenderer
implements
ListCellRenderer
<
FileFilter
>
{
private
ListCellRenderer
<?
super
FileFilter
>
delegate
;
private
FilterComboBoxRenderer
(
ListCellRenderer
<?
super
FileFilter
>
delegate
)
{
this
.
delegate
=
delegate
;
}
public
Component
getListCellRendererComponent
(
JList
list
,
Object
value
,
int
index
,
boolean
isSelected
,
boolean
cellHasFocus
)
{
public
Component
getListCellRendererComponent
(
JList
<?
extends
FileFilter
>
list
,
FileFilter
value
,
int
index
,
boolean
isSelected
,
boolean
cellHasFocus
)
{
Component
c
=
delegate
.
getListCellRendererComponent
(
list
,
value
,
index
,
isSelected
,
cellHasFocus
);
String
text
=
null
;
if
(
value
!=
null
&&
value
instanceof
FileFilter
)
{
text
=
((
FileFilter
)
value
)
.
getDescription
();
if
(
value
!=
null
)
{
text
=
value
.
getDescription
();
}
//this should always be true, since SynthComboBoxUI's SynthComboBoxRenderer
...
...
@@ -924,7 +923,8 @@ public class SynthFileChooserUIImpl extends SynthFileChooserUI {
/**
* Data model for a type-face selection combo-box.
*/
protected
class
FilterComboBoxModel
extends
AbstractListModel
implements
ComboBoxModel
,
PropertyChangeListener
{
protected
class
FilterComboBoxModel
extends
AbstractListModel
<
FileFilter
>
implements
ComboBoxModel
<
FileFilter
>,
PropertyChangeListener
{
protected
FileFilter
[]
filters
;
protected
FilterComboBoxModel
()
{
super
();
...
...
@@ -977,7 +977,7 @@ public class SynthFileChooserUIImpl extends SynthFileChooserUI {
}
}
public
Object
getElementAt
(
int
index
)
{
public
FileFilter
getElementAt
(
int
index
)
{
if
(
index
>
getSize
()
-
1
)
{
// This shouldn't happen. Try to recover gracefully.
return
getFileChooser
().
getFileFilter
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录