Browse Source
Merge in DESIGN/design from ~LEVY.XIE/design:newui to newui * commit '2e06f2d7f185ac8aff95b1031837cd31829a92ad': REPORT-111995 【UI翻新】滚动面板补充storyboard&解决控件面板一些问题newui
Levy.Xie-解安森
10 months ago
4 changed files with 103 additions and 12 deletions
@ -0,0 +1,77 @@
|
||||
package com.fr.design.gui.storybook.components; |
||||
|
||||
import com.fine.swing.ui.layout.Column; |
||||
import com.fine.theme.light.ui.FineRoundBorder; |
||||
import com.fine.theme.utils.FineUIUtils; |
||||
import com.fr.design.gui.icontainer.UIScrollPane; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.storybook.StoryBoard; |
||||
|
||||
import javax.swing.JComponent; |
||||
import javax.swing.JPanel; |
||||
import javax.swing.ScrollPaneConstants; |
||||
import java.awt.Dimension; |
||||
import java.util.Collections; |
||||
|
||||
import static com.fine.swing.ui.layout.Layouts.cell; |
||||
import static com.fine.swing.ui.layout.Layouts.column; |
||||
import static com.fine.swing.ui.layout.Layouts.row; |
||||
|
||||
/** |
||||
* 滚动面板 |
||||
* |
||||
* @author Levy.Xie |
||||
* @since 11.0 |
||||
* Created on 2024/01/25 |
||||
*/ |
||||
public class UIScrollPaneStoryBoard extends StoryBoard { |
||||
public UIScrollPaneStoryBoard() { |
||||
super("滚动面板"); |
||||
add( |
||||
row(20, |
||||
column( |
||||
cell(new UILabel("滚动条常驻显示")).with(this::h2), |
||||
cell(new UILabel("水平/纵向")).with(this::h2), |
||||
cell(new UIScrollPane(createMultiLabelPane())).with(this::setFixSize), |
||||
cell(new UILabel("水平")).with(this::h3), |
||||
cell(new UIScrollPane(createMultiLabelPane(), |
||||
ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED)) |
||||
.with(this::setFixSize), |
||||
cell(new UILabel("纵向")).with(this::h3), |
||||
cell(new UIScrollPane(createMultiLabelPane(), |
||||
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)) |
||||
.with(this::setFixSize) |
||||
).weight(1), |
||||
|
||||
column( |
||||
cell(new UILabel("滚动条悬浮显示")).with(this::h2), |
||||
cell(new UILabel("水平/纵向")).with(this::h3), |
||||
cell(FineUIUtils.createCollapsibleScrollBarLayer(createMultiLabelPane())).with(it -> setFixSize(it.getView())), |
||||
cell(new UILabel("水平")).with(this::h3), |
||||
cell(FineUIUtils.createCollapsibleScrollBarLayer(createMultiLabelPane(), |
||||
ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED |
||||
)).with(it -> setFixSize(it.getView())), |
||||
cell(new UILabel("纵向")).with(this::h3), |
||||
cell(FineUIUtils.createCollapsibleScrollBarLayer(createMultiLabelPane(), |
||||
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER |
||||
)).with(it -> setFixSize(it.getView()) |
||||
) |
||||
).weight(1) |
||||
) |
||||
); |
||||
} |
||||
|
||||
private JPanel createMultiLabelPane() { |
||||
Column column = new Column(); |
||||
for (int i = 0; i < 10; i++) { |
||||
column.add(new UILabel(String.join(" ", Collections.nCopies(20, "test")))); |
||||
} |
||||
return column; |
||||
} |
||||
|
||||
private void setFixSize(JComponent component) { |
||||
component.setPreferredSize(new Dimension(component.getWidth(), 100)); |
||||
component.setBorder(new FineRoundBorder()); |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue