@ -1,13 +1,18 @@
package com.fr.design.mainframe.alphafine.component ;
package com.fr.design.mainframe.alphafine.component ;
import com.fine.swing.ui.layout.Row ;
import com.fine.theme.icon.LazyIcon ;
import com.fine.theme.utils.FineUIScale ;
import com.fine.theme.utils.FineUIStyle ;
import com.fine.theme.utils.FineUIUtils ;
import com.formdev.flatlaf.ui.FlatUIUtils ;
import com.formdev.flatlaf.util.ScaledEmptyBorder ;
import com.fr.base.svg.IconUtils ;
import com.fr.base.svg.IconUtils ;
import com.fr.base.svg.SVGLoader ;
import com.fr.base.svg.SVGLoader ;
import com.fr.design.DesignerEnvManager ;
import com.fr.design.DesignerEnvManager ;
import com.fr.design.actions.help.alphafine.AlphaFineConfigManager ;
import com.fr.design.actions.help.alphafine.AlphaFineConfigManager ;
import com.fr.design.actions.help.alphafine.AlphaFineConstants ;
import com.fr.design.actions.help.alphafine.AlphaFineConstants ;
import com.fr.design.actions.help.alphafine.AlphaFineShortCutUtil ;
import com.fr.design.actions.help.alphafine.AlphaFineShortCutUtil ;
import com.fr.design.constants.UIConstants ;
import com.fr.design.gui.borders.UITextFieldBorder ;
import com.fr.design.gui.ibutton.UIButton ;
import com.fr.design.gui.ibutton.UIButton ;
import com.fr.design.gui.ilable.UILabel ;
import com.fr.design.gui.ilable.UILabel ;
import com.fr.design.mainframe.alphafine.AlphaFineHelper ;
import com.fr.design.mainframe.alphafine.AlphaFineHelper ;
@ -37,19 +42,18 @@ import com.fr.design.mainframe.alphafine.search.manager.impl.PluginSearchManager
import com.fr.design.mainframe.alphafine.search.manager.impl.ProductNewsSearchManager ;
import com.fr.design.mainframe.alphafine.search.manager.impl.ProductNewsSearchManager ;
import com.fr.design.mainframe.alphafine.search.manager.impl.SegmentationManager ;
import com.fr.design.mainframe.alphafine.search.manager.impl.SegmentationManager ;
import com.fr.design.mainframe.alphafine.search.manager.impl.TemplateResourceSearchManager ;
import com.fr.design.mainframe.alphafine.search.manager.impl.TemplateResourceSearchManager ;
import com.fr.design.utils.DesignUtils ;
import com.fr.design.utils.gui.GUICoreUtils ;
import com.fr.design.utils.gui.GUICoreUtils ;
import com.fr.general.ComparatorUtils ;
import com.fr.general.ComparatorUtils ;
import com.fr.stable.StringUtils ;
import com.fr.stable.StringUtils ;
import javax.swing.BorderFactory ;
import javax.swing.BorderFactory ;
import javax.swing.Icon ;
import javax.swing.JButton ;
import javax.swing.JButton ;
import javax.swing.JFrame ;
import javax.swing.JFrame ;
import javax.swing.JPanel ;
import javax.swing.JPanel ;
import javax.swing.JPopupMenu ;
import javax.swing.JPopupMenu ;
import javax.swing.SwingConstants ;
import javax.swing.SwingConstants ;
import javax.swing.Timer ;
import javax.swing.Timer ;
import javax.swing.border.LineBorder ;
import javax.swing.event.PopupMenuEvent ;
import javax.swing.event.PopupMenuEvent ;
import javax.swing.event.PopupMenuListener ;
import javax.swing.event.PopupMenuListener ;
import java.awt.BorderLayout ;
import java.awt.BorderLayout ;
@ -61,7 +65,6 @@ import java.awt.Font;
import java.awt.Graphics ;
import java.awt.Graphics ;
import java.awt.Graphics2D ;
import java.awt.Graphics2D ;
import java.awt.Image ;
import java.awt.Image ;
import java.awt.Insets ;
import java.awt.RenderingHints ;
import java.awt.RenderingHints ;
import java.awt.Toolkit ;
import java.awt.Toolkit ;
import java.awt.Window ;
import java.awt.Window ;
@ -81,6 +84,13 @@ import java.util.Map;
import java.util.Set ;
import java.util.Set ;
import java.util.regex.Matcher ;
import java.util.regex.Matcher ;
import java.util.regex.Pattern ;
import java.util.regex.Pattern ;
import org.jetbrains.annotations.NotNull ;
import static com.fine.swing.ui.layout.Layouts.cell ;
import static com.fine.swing.ui.layout.Layouts.row ;
import static com.fine.swing.ui.layout.Layouts.column ;
import static com.fine.swing.ui.layout.Layouts.flex ;
/ * *
/ * *
* @author hades
* @author hades
@ -123,7 +133,7 @@ public class AlphaFineFrame extends JFrame {
private static final Image SEARCH_IMAGE = SVGLoader . load ( "/com/fr/design/mainframe/alphafine/images/search.svg" ) ;
private static final Image SEARCH_IMAGE = SVGLoader . load ( "/com/fr/design/mainframe/alphafine/images/search.svg" ) ;
private static final Color BORDER_COLOR = new Color ( 232 , 232 , 233 ) ;
private static final Color FLESH_BLUE = FlatUIUtils . getUIColor ( "brand.normal" , Color . BLUE ) ;
private final CardLayout cardLayout = new CardLayout ( ) ;
private final CardLayout cardLayout = new CardLayout ( ) ;
@ -259,45 +269,46 @@ public class AlphaFineFrame extends JFrame {
* 初始化全部组件
* 初始化全部组件
* /
* /
private void initComponents ( ) {
private void initComponents ( ) {
add ( createTopPane ( ) , BorderLayout . NORTH ) ;
add ( column ( 10 ,
initSearchTextField ( ) ;
cell ( createTopPane ( ) ) ,
add ( createSearchPane ( ) , BorderLayout . CENTER ) ;
cell ( createSearchPane ( ) ) ,
add ( createShowPane ( ) , BorderLayout . SOUTH ) ;
cell ( createShowPane ( ) )
) . getComponent ( ) ) ;
this . getContentPane ( ) . setBackground ( Color . WHITE ) ;
this . getContentPane ( ) . setBackground ( Color . WHITE ) ;
this . setIconImage ( SEARCH_IMAGE ) ; // 应用图标
this . setIconImage ( SEARCH_IMAGE ) ; // 应用图标
}
}
private JPanel createTopPane ( ) {
private JPanel createTopPane ( ) {
JPanel topPane = new JPanel ( new BorderLayout ( ) ) ;
JPanel topPane = new JPanel ( new BorderLayout ( ) ) ;
topPane . setBorder ( BorderFactory . createEmptyBorder ( 10 , 10 , 10 , 10 ) ) ;
topPane . setBorder ( new ScaledEmptyBorder ( 10 , 20 , 0 , 20 ) ) ;
topPane . setBackground ( Color . WHITE ) ;
UILabel topLeftPane = new UILabel ( AlphaFineConstants . TITLE ) ;
JPanel topLeftPane = new JPanel ( new FlowLayout ( FlowLayout . LEFT ) ) ;
topLeftPane . setFont ( new Font ( "Arial Black" , Font . PLAIN , FineUIScale . scale ( 20 ) ) ) ;
topLeftPane . setBackground ( Color . WHITE ) ;
topLeftPane . setForeground ( FLESH_BLUE ) ;
UILabel alphaFineLabel = new UILabel ( AlphaFineConstants . TITLE ) ;
topLeftPane . setOpaque ( false ) ;
alphaFineLabel . setFont ( new Font ( "Arial Black" , Font . PLAIN , 20 ) ) ;
alphaFineLabel . setForeground ( UIConstants . FLESH_BLUE ) ;
topLeftPane . add ( alphaFineLabel ) ;
topPane . add ( topLeftPane , BorderLayout . WEST ) ;
topPane . add ( topLeftPane , BorderLayout . WEST ) ;
JPanel topRightPane = new JPanel ( new FlowLayout ( FlowLayout . RIGHT , 10 , 10 ) ) ;
topRightPane . setBackground ( Color . WHITE ) ;
JPanel tipPane = new JPanel ( new BorderLayout ( ) ) ;
tipPane . setBackground ( Color . WHITE ) ;
tipIconLabel = new UILabel ( AlphaFineConstants . BULB_ICON ) ;
tipIconLabel = new UILabel ( AlphaFineConstants . BULB_ICON ) ;
tipIconLabel . addMouseListener ( tipMouseListener ) ;
tipIconLabel . addMouseListener ( tipMouseListener ) ;
useTipLabel = new UILabel ( SKILLS ) ;
useTipLabel = new UILabel ( SKILLS , FineUIStyle . LABEL_HIGHLIGHT ) ;
useTipLabel . addMouseListener ( tipMouseListener ) ;
useTipLabel . addMouseListener ( tipMouseListener ) ;
useTipLabel . setForeground ( AlphaFineConstants . FOREGROUND_COLOR_6 ) ;
UIButton minimizeButton = new UIButton ( new LazyIcon ( "minimize" ) ) ;
tipPane . add ( tipIconLabel , BorderLayout . WEST ) ;
tipPane . add ( useTipLabel , BorderLayout . CENTER ) ;
topRightPane . add ( tipPane ) ;
UIButton minimizeButton = createButton ( IconUtils . readIcon ( "/com/fr/design/mainframe/alphafine/images/minimize.svg" ) ) ;
minimizeButton . addActionListener ( e - > AlphaFineFrame . this . setExtendedState ( JFrame . ICONIFIED ) ) ;
minimizeButton . addActionListener ( e - > AlphaFineFrame . this . setExtendedState ( JFrame . ICONIFIED ) ) ;
topRightPane . add ( minimizeButton ) ;
FineUIStyle . setStyle ( minimizeButton , FineUIStyle . ORIGINAL_BUTTON ) ;
UIButton closeButton = createButton ( IconUtils . readIcon ( "/com/fr/design/mainframe/alphafine/images/close.svg" ) ) ;
minimizeButton . setBackground ( Color . WHITE ) ;
UIButton closeButton = new UIButton ( new LazyIcon ( "close" ) ) ;
closeButton . addActionListener ( e - > AlphaFineFrame . this . dispose ( ) ) ;
closeButton . addActionListener ( e - > AlphaFineFrame . this . dispose ( ) ) ;
topRightPane . add ( closeButton ) ;
FineUIStyle . setStyle ( closeButton , FineUIStyle . ORIGINAL_BUTTON ) ;
topPane . add ( topRightPane , BorderLayout . EAST ) ;
closeButton . setBackground ( Color . WHITE ) ;
JPanel topRightPane = new JPanel ( new BorderLayout ( ) ) ;
topRightPane . setOpaque ( false ) ;
topRightPane . add ( row ( 16 ,
row ( cell ( tipIconLabel ) , cell ( useTipLabel ) ) ,
cell ( minimizeButton ) ,
cell ( closeButton )
) . getComponent ( ) ) ;
topPane . add ( column ( flex ( ) , cell ( topRightPane ) , flex ( ) ) . getComponent ( ) , BorderLayout . EAST ) ;
topPane . setOpaque ( false ) ;
return topPane ;
return topPane ;
}
}
@ -313,30 +324,29 @@ public class AlphaFineFrame extends JFrame {
@Override
@Override
public void mouseExited ( MouseEvent e ) {
public void mouseExited ( MouseEvent e ) {
if ( popupMenu = = null | | ! popupMenu . isShowing ( ) ) {
if ( popupMenu = = null | | ! popupMenu . isShowing ( ) ) {
useTipLabel . setForeground ( AlphaFineConstants . FOREGROUND_COLOR_6 ) ;
useTipLabel . setForeground ( FineUIUtils . getUIColor ( "Label.highLightColor" , "Label.highLightColor" ) ) ;
tipIconLabel . setIcon ( AlphaFineConstants . BULB_ICON ) ;
tipIconLabel . setIcon ( AlphaFineConstants . BULB_ICON ) ;
}
}
}
}
@Override
@Override
public void mousePressed ( MouseEvent e ) {
public void mousePressed ( MouseEvent e ) {
useTipLabel . setForeground ( UIConstants . FLESH_BLUE ) ;
useTipLabel . setForeground ( FLESH_BLUE ) ;
tipIconLabel . setIcon ( AlphaFineConstants . LIGHT_YELLOW_BULB_ICON ) ;
tipIconLabel . setIcon ( AlphaFineConstants . LIGHT_YELLOW_BULB_ICON ) ;
popupMenu = createTipPop ( ) ;
popupMenu = createTipPop ( ) ;
GUICoreUtils . showPopupMenu ( popupMenu , e . getComponent ( ) , e . getComponent ( ) . getX ( ) - 60 , e . getComponent ( ) . getY ( ) + 20 ) ;
GUICoreUtils . showPopupMenu ( popupMenu , e . getComponent ( ) , e . getComponent ( ) . getX ( ) - FineUIScale . scale ( 60 ) , e . getComponent ( ) . getY ( ) + FineUIScale . scale ( 20 ) ) ;
}
}
} ;
} ;
private JPopupMenu createTipPop ( ) {
private JPopupMenu createTipPop ( ) {
JPanel panel = new JPanel ( new BorderLayout ( ) ) ;
JPanel panel = new JPanel ( new BorderLayout ( ) ) ;
String toolTip = AlphaFineShortCutUtil . getDisplayShortCut ( com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Report_AlphaFine_Short_Cut" , DesignerEnvManager . getEnvManager ( ) . getAlphaFineConfigManager ( ) . getShortcuts ( ) ) ) ;
String toolTip = AlphaFineShortCutUtil . getDisplayShortCut ( com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Report_AlphaFine_Short_Cut" , DesignerEnvManager . getEnvManager ( ) . getAlphaFineConfigManager ( ) . getShortcuts ( ) ) ) ;
UILabel label = new UILabel ( toolTip ) ;
UILabel label = new UILabel ( toolTip , FineUIStyle . LABEL_HIGHLIGHT ) ;
label . setForeground ( AlphaFineConstants . FOREGROUND_COLOR_8 ) ;
label . setBackground ( Color . WHITE ) ;
label . setBackground ( Color . WHITE ) ;
panel . add ( label ) ;
panel . add ( label ) ;
panel . setBackground ( Color . WHITE ) ;
panel . setBackground ( Color . WHITE ) ;
JPopupMenu popupMenu = new JPopupMenu ( ) ;
JPopupMenu popupMenu = new JPopupMenu ( ) ;
popupMenu . setBorder ( BorderFactory . create EmptyBorder( 20 , 5 , 10 , 5 ) ) ;
popupMenu . setBorder ( new Scaled EmptyBorder( 20 , 5 , 10 , 5 ) ) ;
popupMenu . add ( panel ) ;
popupMenu . add ( panel ) ;
popupMenu . setBackground ( Color . WHITE ) ;
popupMenu . setBackground ( Color . WHITE ) ;
popupMenu . addPopupMenuListener ( new PopupMenuListener ( ) {
popupMenu . addPopupMenuListener ( new PopupMenuListener ( ) {
@ -347,7 +357,7 @@ public class AlphaFineFrame extends JFrame {
@Override
@Override
public void popupMenuWillBecomeInvisible ( PopupMenuEvent e ) {
public void popupMenuWillBecomeInvisible ( PopupMenuEvent e ) {
useTipLabel . setForeground ( AlphaFineConstants . FOREGROUND_COLOR_6 ) ;
useTipLabel . setForeground ( FineUIUtils . getUIColor ( "Label.highLightColor" , "Label.highLightColor" ) ) ;
tipIconLabel . setIcon ( AlphaFineConstants . BULB_ICON ) ;
tipIconLabel . setIcon ( AlphaFineConstants . BULB_ICON ) ;
}
}
@ -361,15 +371,14 @@ public class AlphaFineFrame extends JFrame {
private JPanel createSearchPane ( ) {
private JPanel createSearchPane ( ) {
JPanel searchPane = new JPanel ( new BorderLayout ( ) ) ;
JPanel searchPane = new JPanel ( new BorderLayout ( ) ) ;
searchPane . setBorder ( BorderFactory . createEmptyBorder ( 0 , 20 , 0 , 20 ) ) ;
searchPane . setPreferredSize ( FineUIScale . createScaleDimension ( 632 , 32 ) ) ;
searchTextFieldWrapperPane = new JPanel ( new BorderLayout ( ) ) {
searchPane . setBorder ( new ScaledEmptyBorder ( 0 , 20 , 0 , 20 ) ) ;
@Override
protected void paintBorder ( Graphics g ) {
searchTextField = new AlphaFineTextField ( PLACE_HOLDER ) ;
g . setColor ( BORDER_COLOR ) ;
initTextFieldListener ( ) ;
g . drawRoundRect ( 0 , 0 , getWidth ( ) - 1 , getHeight ( ) - 1 , 5 , 5 ) ;
searchTextField . setBackground ( Color . WHITE ) ;
}
} ;
searchTextFieldWrapperPane = new JPanel ( new BorderLayout ( ) ) ;
searchTextFieldWrapperPane . setBorder ( new UITextFieldBorder ( new Insets ( 2 , 3 , 2 , 3 ) ) ) ;
searchTextFieldWrapperPane . setBackground ( Color . WHITE ) ;
searchTextFieldWrapperPane . setBackground ( Color . WHITE ) ;
searchTextFieldWrapperPane . add ( searchTextField , BorderLayout . CENTER ) ;
searchTextFieldWrapperPane . add ( searchTextField , BorderLayout . CENTER ) ;
clearLabel = new UILabel ( IconUtils . readIcon ( "/com/fr/design/mainframe/alphafine/images/clear.svg" ) ) ;
clearLabel = new UILabel ( IconUtils . readIcon ( "/com/fr/design/mainframe/alphafine/images/clear.svg" ) ) ;
@ -383,14 +392,25 @@ public class AlphaFineFrame extends JFrame {
}
}
} ) ;
} ) ;
searchTextFieldWrapperPane . add ( clearLabel , BorderLayout . EAST ) ;
searchTextFieldWrapperPane . add ( clearLabel , BorderLayout . EAST ) ;
searchTextFieldWrapperPane . setBorder ( BorderFactory . createCompoundBorder (
new LineBorder ( FlatUIUtils . getUIColor ( "defaultBorderColor" , Color . BLACK ) ) ,
new ScaledEmptyBorder ( 0 , 0 , 0 , 6 )
) ) ;
searchPane . add ( searchTextFieldWrapperPane , BorderLayout . CENTER ) ;
searchPane . add ( searchTextFieldWrapperPane , BorderLayout . CENTER ) ;
JButton searchButton = getSearchButton ( ) ;
searchPane . add ( searchButton , BorderLayout . EAST ) ;
searchPane . setBackground ( Color . WHITE ) ;
return searchPane ;
}
private @NotNull JButton getSearchButton ( ) {
JButton searchButton = new JButton ( SEARCH ) {
JButton searchButton = new JButton ( SEARCH ) {
@Override
@Override
public void paintComponent ( Graphics g ) {
public void paintComponent ( Graphics g ) {
Graphics2D g2d = ( Graphics2D ) g ;
Graphics2D g2d = ( Graphics2D ) g ;
g2d . setRenderingHint ( RenderingHints . KEY_ANTIALIASING , RenderingHints . VALUE_ANTIALIAS_ON ) ;
g2d . setRenderingHint ( RenderingHints . KEY_ANTIALIASING , RenderingHints . VALUE_ANTIALIAS_ON ) ;
g2d . setColor ( UIConstants . FLESH_BLUE ) ;
g2d . setColor ( FLESH_BLUE ) ;
g2d . fillRoundRect ( 0 , 0 , getWidth ( ) , getHeight ( ) , 4 , 4 ) ;
g2d . fillRoundRect ( 0 , 0 , getWidth ( ) , getHeight ( ) , FineUIScale . scale ( 4 ) , FineUIScale . scale ( 4 ) ) ;
super . paintComponent ( g2d ) ;
super . paintComponent ( g2d ) ;
}
}
} ;
} ;
@ -400,13 +420,10 @@ public class AlphaFineFrame extends JFrame {
fireSearch ( ) ;
fireSearch ( ) ;
}
}
} ) ;
} ) ;
searchButton . setPreferredSize ( new Dimension ( 70 , 60 ) ) ;
searchButton . setForeground ( Color . WHITE ) ;
searchButton . setForeground ( Color . WHITE ) ;
searchButton . setBorderPainted ( false ) ;
searchButton . setBorderPainted ( false ) ;
searchButton . setContentAreaFilled ( false ) ;
searchButton . setContentAreaFilled ( false ) ;
searchPane . add ( searchButton , BorderLayout . EAST ) ;
return searchButton ;
searchPane . setBackground ( Color . WHITE ) ;
return searchPane ;
}
}
/ * *
/ * *
@ -414,7 +431,6 @@ public class AlphaFineFrame extends JFrame {
* /
* /
private JPanel createShowPane ( ) {
private JPanel createShowPane ( ) {
JPanel showPane = new JPanel ( new BorderLayout ( ) ) ;
JPanel showPane = new JPanel ( new BorderLayout ( ) ) ;
// 内容区,card layout
// 内容区,card layout
resultPane . add ( new DefaultProductNewsPane ( ) , CellType . PRODUCT_NEWS . getFlagStr4None ( ) ) ;
resultPane . add ( new DefaultProductNewsPane ( ) , CellType . PRODUCT_NEWS . getFlagStr4None ( ) ) ;
resultPane . add ( new NoResultWithLinkPane ( GO_FORUM , AlphaFineConstants . NO_RESULT_ICON ) , CellType . NO_RESULT . getFlagStr4None ( ) ) ;
resultPane . add ( new NoResultWithLinkPane ( GO_FORUM , AlphaFineConstants . NO_RESULT_ICON ) , CellType . NO_RESULT . getFlagStr4None ( ) ) ;
@ -424,24 +440,25 @@ public class AlphaFineFrame extends JFrame {
resultPane . add ( new HelpDocumentNoResultPane ( SEARCH_TERM , AlphaFineConstants . NO_RESULT_ICON ) , CellType . DOCUMENT . getFlagStr4None ( ) ) ;
resultPane . add ( new HelpDocumentNoResultPane ( SEARCH_TERM , AlphaFineConstants . NO_RESULT_ICON ) , CellType . DOCUMENT . getFlagStr4None ( ) ) ;
resultPane . add ( TemplateShopPane . getInstance ( ) , CellType . TEMPLATE_SHOP . getFlagStr4None ( ) ) ;
resultPane . add ( TemplateShopPane . getInstance ( ) , CellType . TEMPLATE_SHOP . getFlagStr4None ( ) ) ;
resultPane . add ( new NetWorkFailedPane ( this : : reSearch ) , AlphaFineConstants . NETWORK_ERROR ) ;
resultPane . add ( new NetWorkFailedPane ( this : : reSearch ) , AlphaFineConstants . NETWORK_ERROR ) ;
//resultPane.setBackground(Color.WHITE);
// label区,border layout
// label区,border layout
labelPane = new JPanel ( new BorderLayout ( ) ) ;
labelPane = new JPanel ( new BorderLayout ( ) ) ;
labelPane . setBorder ( BorderFactory . createEmptyBorder ( 0 , 20 , 0 , 20 ) ) ;
labelPane . setBackground ( Color . WHITE ) ;
labelPane . setBackground ( Color . WHITE ) ;
labelContentPane = new JPanel ( new BorderLayout ( ) ) ;
labelContentPane = new JPanel ( new BorderLayout ( ) ) ;
tabLabel = createTabLabel ( AlphaFineConstants . PRODUCT_NEWS ) ;
tabLabel = createTabLabel ( AlphaFineConstants . PRODUCT_NEWS ) ;
labelWestPane = new JPanel ( new FlowLayout ( FlowLayout . LEFT , 0 , 0 ) ) ;
labelWestPane = new JPanel ( new FlowLayout ( FlowLayout . LEFT , 0 , 0 ) ) ;
labelWestPane . add ( tabLabel ) ;
labelWestPane . add ( tabLabel ) ;
labelWestPane . setOpaque ( false ) ;
labelContentPane . add ( labelWestPane , BorderLayout . WEST ) ;
labelContentPane . add ( labelWestPane , BorderLayout . WEST ) ;
labelEastPane = new JPanel ( new FlowLayout ( FlowLayout . RIGHT , 0 , 0 ) ) ;
labelEastPane = new JPanel ( new FlowLayout ( FlowLayout . RIGHT , 0 , 0 ) ) ;
// 一键已读
// 一键已读
readLabel = new UILabel ( ONE_CLICK_READ ) ;
readLabel = new UILabel ( ONE_CLICK_READ ) ;
readLabel . setHorizontalAlignment ( SwingConstants . RIGHT ) ;
readLabel . setHorizontalAlignment ( SwingConstants . RIGHT ) ;
readLabel . setBorder ( BorderFactory . createEmptyBorder ( 0 , 0 , 0 , 10 ) ) ;
readLabel . setBorder ( BorderFactory . createEmptyBorder ( 0 , 0 , 0 , 10 ) ) ;
readLabel . setPreferredSize ( new Dimension ( 100 , 30 ) ) ;
readLabel . setPreferredSize ( FineUIScale . createScale Dimension( 100 , 30 ) ) ;
readLabel . setForeground ( UIConstants . FLESH_BLUE ) ;
readLabel . setForeground ( FLESH_BLUE ) ;
readLabel . addMouseListener ( new MouseAdapter ( ) {
readLabel . addMouseListener ( new MouseAdapter ( ) {
@Override
@Override
public void mousePressed ( MouseEvent e ) {
public void mousePressed ( MouseEvent e ) {
@ -450,14 +467,18 @@ public class AlphaFineFrame extends JFrame {
}
}
} ) ;
} ) ;
labelEastPane . add ( readLabel ) ;
labelEastPane . add ( readLabel ) ;
labelEastPane . setOpaque ( false ) ;
labelContentPane . add ( labelEastPane , BorderLayout . EAST ) ;
labelContentPane . add ( labelEastPane , BorderLayout . EAST ) ;
labelContentPane . setBackground ( new Color ( 245 , 245 , 247 ) ) ;
labelContentPane . setBackground ( FineUIUtils . getUIColor ( "FineTabbedPane.background" , "fill.gray" ) ) ;
labelPane . add ( labelContentPane ) ;
labelPane . add ( labelContentPane ) ;
labelPane . setPreferredSize ( new Dimension ( AlphaFineConstants . FULL_SIZE . width , 30 ) ) ;
labelPane . setPreferredSize ( new Dimension ( AlphaFineConstants . FULL_SIZE . width , FineUIScale . scale ( 28 ) ) ) ;
// tab区 flow layout
// tab区 flow layout
tabPane = new JPanel ( new FlowLayout ( FlowLayout . LEFT , 20 , 10 ) ) ;
tabPane = new JPanel ( new BorderLayout ( ) ) ;
tabPane . setBackground ( Color . WHITE ) ;
Row tabRow = new Row ( ) ;
tabRow . setSpacing ( 20 ) ;
tabPane . add ( tabRow ) ;
tabPane . setOpaque ( false ) ;
List < SelectedLabel > selectedLabelList = createSelectedLabelList ( ) ;
List < SelectedLabel > selectedLabelList = createSelectedLabelList ( ) ;
selectedTab = null ;
selectedTab = null ;
for ( SelectedLabel label : selectedLabelList ) {
for ( SelectedLabel label : selectedLabelList ) {
@ -472,19 +493,22 @@ public class AlphaFineFrame extends JFrame {
}
}
for ( SelectedLabel label : selectedLabelList ) {
for ( SelectedLabel label : selectedLabelList ) {
label . addMouseListener ( createMouseListener ( selectedLabelList , label , tabPane , tabLabel , readLabel ) ) ;
label . addMouseListener ( createMouseListener ( selectedLabelList , label , tabPane , tabLabel , readLabel ) ) ;
tabPane . add ( label ) ;
tabRow . add ( label ) ;
}
}
showPane . add ( tabPane , BorderLayout . NORTH ) ;
showPane . setBackground ( Color . WHITE ) ;
showPane . add ( labelPane , BorderLayout . CENTER ) ;
showPane . setBorder ( new ScaledEmptyBorder ( 0 , 20 , 0 , 20 ) ) ;
showPane . add ( resultPane , BorderLayout . SOUTH ) ;
showPane . add ( column ( 10 ,
cell ( tabPane ) ,
cell ( labelPane ) ,
cell ( resultPane )
) . getComponent ( ) ) ;
return showPane ;
return showPane ;
}
}
private UILabel createTabLabel ( String labelName ) {
private UILabel createTabLabel ( String labelName ) {
UILabel label = new UILabel ( labelName ) ;
UILabel label = new UILabel ( labelName , FineUIStyle . STYLE_PRIMARY ) ;
label . setBorder ( BorderFactory . createEmptyBorder ( 0 , 10 , 0 , 0 ) ) ;
label . setBorder ( new ScaledEmptyBorder ( 0 , 10 , 0 , 0 ) ) ;
label . setPreferredSize ( new Dimension ( 60 , 30 ) ) ;
label . setPreferredSize ( FineUIScale . createScaleDimension ( 60 , 30 ) ) ;
label . setForeground ( AlphaFineConstants . LABEL_SELECTED ) ;
return label ;
return label ;
}
}
@ -725,12 +749,7 @@ public class AlphaFineFrame extends JFrame {
}
}
private void initSearchTextField ( ) {
private void initSearchTextField ( ) {
searchTextField = new AlphaFineTextField ( PLACE_HOLDER ) ;
initTextFieldListener ( ) ;
searchTextField . setFont ( DesignUtils . getDefaultGUIFont ( ) . applySize ( 14 ) ) ;
searchTextField . setBackground ( Color . WHITE ) ;
searchTextField . setPreferredSize ( new Dimension ( 300 , 60 ) ) ;
searchTextField . setBorder ( null ) ;
}
}
private void initTextFieldListener ( ) {
private void initTextFieldListener ( ) {
@ -963,23 +982,6 @@ public class AlphaFineFrame extends JFrame {
return searchText ;
return searchText ;
}
}
private UIButton createButton ( Icon icon ) {
UIButton button = new UIButton ( ) {
@Override
public void paintComponent ( Graphics g ) {
g . setColor ( Color . WHITE ) ;
g . fillRect ( 0 , 0 , getSize ( ) . width , getSize ( ) . height ) ;
super . paintComponent ( g ) ;
}
} ;
button . setPreferredSize ( new Dimension ( 20 , 20 ) ) ;
button . setIcon ( icon ) ;
button . set4ToolbarButton ( ) ;
button . setBorderPainted ( false ) ;
button . setRolloverEnabled ( false ) ;
return button ;
}
/ * *
/ * *
* 设置面板位置
* 设置面板位置
*
*