小编bak*_*a12的帖子

为什么HTMLDocument会忽略空格

我有个问题.它看起来HTMLEditorKit只是忽略空格.有我的示例代码:

public class TestEditor extends JFrame {

public TestEditor(){
    createConnection();
    createGUI();
}
private void createGUI(){
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    JScrollPane scroll1=new JScrollPane(text);
    JScrollPane scroll2=new JScrollPane(html);
    JSplitPane split=new JSplitPane();
    split.setLeftComponent(scroll1);
    split.setRightComponent(scroll2);
    split.setDividerLocation(0.5);
    split.setResizeWeight(0.5);
    getContentPane().add(split);
    setTitle("Test");
    setPreferredSize(new Dimension(600,300));
    pack();
}
private void createConnection(){
    text=new JTextPane();
    html=new JTextPane();
    html.setContentType("text/html");
    html.getStyledDocument().addDocumentListener(new DocumentListener() {
        @Override
        public void insertUpdate(DocumentEvent e) {
            update();
        }
        @Override
        public void removeUpdate(DocumentEvent e) {
            update();
        }
        @Override
        public void changedUpdate(DocumentEvent e) {
            update();
        }
        private void update(){
            if(fromText) return;
            fromHtml=true;
            text.setText(html.getText());
            fromHtml=false; …
Run Code Online (Sandbox Code Playgroud)

java swing whitespace htmleditorkit

2
推荐指数
1
解决办法
328
查看次数

删除 wpf 窗口上显示的奇怪的黑色面板或工具栏

我想摆脱这个 Visual Studio 生成的黑色东西显示在我的 WPF 窗口中。我什至不知道它是什么,所以我在互联网上找不到任何关于它的信息。

我想摆脱它

谢谢您的帮助。

c# wpf window visual-studio

2
推荐指数
1
解决办法
2264
查看次数

如何在PathGeometry中使用来自资源的PathFigure?

我想知道是否有任何方法可以在xaml中使用元素中的PathFigure资源PathGeometry.假设我有一个ResourceDictionary,其中有两个PathFigure对象,'x:Key'属性分别等于"Figure1"和"Figure2".我的目标是创建一个PathGeometry带有Figures包含图1和图2的集合的属性.我可以使用代码隐藏文件轻松地完成它,但是我想知道有没有办法只使用xaml.

<PathFigure IsClosed="True" StartPoint="2,9" x:Key="Figure1">
    <ArcSegment Point="15,9" Size="6.5, 2"/>
    <LineSegment Point="15,12"/>
    <ArcSegment Point="2,12" Size="6.5, 2"/>
</PathFigure>

<PathFigure IsClosed="True" StartPoint="10,7" x:Key="Figure2">
    <LineSegment Point="10, 2"/>
    <LineSegment Point="13,2"/>
    <LineSegment Point="13,7"/>
    <ArcSegment Point="10,7" Size="2,2" IsLargeArc="True"/>
</PathFigure>
Run Code Online (Sandbox Code Playgroud)

我现在可以创建一个PathGeometry:

<PathGeometry FillRule="Nonzero" x:Key="1">
    <PathFigureCollection>
        //Here I want to put Figure1 and Figure2
    </PathFigureCollection>
</PathGeometry>
Run Code Online (Sandbox Code Playgroud)

我想我可以写一些MarkupExtension来做以下事情,但我正在寻找最好的方法.谢谢你的建议.

wpf resources xaml pathgeometry

1
推荐指数
1
解决办法
637
查看次数