小编Kev*_*eid的帖子

使用OpenGL进行高斯模糊(非纹理)

我试图在OpenGL中渲染一个简单的方块,它具有不透明度并且模糊,适用于游戏GUI.它应该有一个guassian模糊效果(这将模糊游戏).

如果有帮助的话,我正在使用一个镶嵌器来绘​​制正方形的4个四边形.

java opengl user-interface

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

如何更改具有特定列值的JTable整行的颜色

我有一个Jtable,它从一组值中填充.我的代码是这样的:

  private static final String[] columnNames = {"Line Number", "Error","Fix Proposed","Percentage (%)"};
  static DefaultTableModel model = new DefaultTableModel(null,columnNames);

  public static void DisplayMyJList(List<CaptureErrors> x,String extension,
        ArrayList<Integer> l,ArrayList<Integer> p,
        ArrayList<String> e,ArrayList<String> s) throws IOException {//Method to Dynamic get values to be populated in Jtable.

    String theExtension = extension;
    if(FILE_EXTENSION.equals("java")) {
        for(CaptureErrors ex: x) {

            Vector row = new Vector();
            row.add(ex.getLinenumber());
            row.add(ex.getMyfounderror());
            row.add(ex.getMycorrection());
            row.add(ex.getMyPercentage()+"%");

            model.addRow( row );

            //model.setRowColour(1, Color.YELLOW);
        }
    }

table = new JTable(model);
    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);    
    table.setFillsViewportHeight(true);
    table.setShowGrid(true);
    table.setShowVerticalLines(true);
    table.setGridColor(new Color(0,128,0));
    JTableHeader header …
Run Code Online (Sandbox Code Playgroud)

java swing jtable tablecellrenderer

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

JTextPane突出显示问题

我一直试图在小文本编辑器中实现突出显示功能的最后几天.出于某种原因,我得到一个奇怪的结果:

在此输入图像描述

给出的例子应该突出显示每个"dolor" - 第一次出现是正确找到并突出显示但下一次出现并未突出显示.

这是我到目前为止编写的代码:

import java.awt.Color;
import java.awt.Dimension;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextPane;
import javax.swing.text.BadLocationException;
import javax.swing.text.DefaultHighlighter;
import javax.swing.text.DefaultHighlighter.DefaultHighlightPainter;
import javax.swing.text.DefaultStyledDocument;

/**
 * Highlighting created on 04.11.2013<br>
 * <br>
 * Specification:<br>
 */
public class Highlighting extends JFrame implements MouseListener {

    private JScrollPane scrollPane;
    private JTextPane textPane;

    private DefaultHighlighter highlighter;
    private DefaultHighlightPainter painter;

    public static void main(String[] args) {
        new Highlighting().setVisible(true);
    }

    /**
     * 
     */
    public Highlighting() {
        this.initialize();
        this.build();
        this.configure();
    }

    /**
     *
     */ …
Run Code Online (Sandbox Code Playgroud)

java swing highlighting jtextpane swing-highlighter

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

如何创建列出其他组件的组件属性?

SynEdit组件具有属性"Highlighter",其中包含一个下拉列表,其中列出了所有当前存在的荧光笔(设计时).对我而言,这似乎是设计时组件的一个非常重要的概念,但我根本无法找到它是如何工作的:

假设您将TSynEdit和TSynPasSyn下载到表单上.然后单击具有Highlighter属性的TSynedit.您现在可以选择以前创建的TSynPasSyn.如果您创建另一个TSynPasSyn,它也将添加到此列表中.我的问题:

在您自己的组件中执行此类操作的最佳方法是哪种?您可以简单地使用属性编辑器,还是需要自定义帮助程序类,或者完全不同的东西?

delphi properties lazarus synedit

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

为什么我需要将IDictionary <T,HashSet <S >>转换为IDictionary <T,IEnumerable <S >>?

以下代码自HashSet实现以来有效IEnumerable:

IEnumerable<TEdge> edges = new HashSet<TEdge>();
Run Code Online (Sandbox Code Playgroud)

但是如果我尝试在Dictionary中使用与键入值相同的值,则会出现编译错误:

IDictionary<TVertex, IEnumerable<TEdge>> vertexEdges = 
    new Dictionary<TVertex, HashSet<TEdge>>();  
Run Code Online (Sandbox Code Playgroud)

Cannot implicitly convert type 'System.Collections.Generic.Dictionary<TVertex,System.Collections.Generic.HashSet<TEdge>>' to 'System.Collections.Generic.IDictionary<TVertex,System.Collections.Generic.IEnumerable<TEdge>>'. An explicit conversion exists (are you missing a cast?)

我在这里错过了什么?当然编译器应该能够弄清楚这一点,所以我猜测要么必须在限制背后做出一些有意义的决定,要么我做错了.

c# dictionary casting type-inference

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

如何在 Rust 中使用任意文本作为函数名?

Rust 有没有办法使用任何文本作为函数名?就像是:

fn 'This is the name of the function'  { ... } 
Run Code Online (Sandbox Code Playgroud)

我发现它对测试功能很有用,其他语言也允许这样做。

rust

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

极地和笛卡尔计算不完全有效?

double testx, testy, testdeg, testrad, endx, endy;

testx = 1;
testy = 1;
testdeg = atan2( testx, testy) / Math::PI* 180;  
testrad = sqrt(pow(testx,2) + pow(testy,2));
endx = testrad * cos(testdeg);
endy = testrad * sin(testdeg);
Run Code Online (Sandbox Code Playgroud)

这个部分似乎等同于正确,除了endx和endy应该= testx和testy他们在手工计算时做.

.net trigonometry cartesian

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

合金表达式类型检查失败

我是 Alloy(规范语言)的初学者,需要根据案例研究做一些进一步的工作,案例研究可以在这里找到(代码在第 5 页)。相关代码:

open util/ordering[Time] as T0

pred Eavesdropping() {   
  some pro:Process | some m:Protected_Msg |  
  some t: (Time - T0/last) - T0/prev[T0/last] |   let t' = T0/t.next |
  let t'' = T0/t'.next |   !HasReadAccess[pro,m] && (m->t in pro.knows)
  &&   (m.contents->t not in pro.knows) &&   (m.contents->t'' in
  pro.knows) && IsUnique(m.contents) }
Run Code Online (Sandbox Code Playgroud)

更正一些语法后,我收到此错误消息:“此表达式无法进行类型检查”,并t'let t' = T0/t.next. 我如何打字t'

logic modeling specifications first-order-logic alloy

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

如何将通信输出通过管道传输到文件?

我已经使用 comm 命令来比较两个文件,但我无法将其通过管道传输到第三个文件:

comm file1 file2 > file3 

comm: file 1 is not in sorted order
comm: file 2 is not in sorted order
Run Code Online (Sandbox Code Playgroud)

我该怎么做呢?文件已经排序。

(comm file1 file2 工作并打印出来)

示例输入:
file1:

21
24
31
36
40
87
105
134
...
Run Code Online (Sandbox Code Playgroud)

文件2:

10
21
31
36
40
40
87
103
...
Run Code Online (Sandbox Code Playgroud)

通信文件 1 文件 2:有效

comm file1 file2 > file3 

comm: file 1 is not in sorted order
comm: file 2 is not in sorted order
Run Code Online (Sandbox Code Playgroud)

unix

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

"git pull origin"和"git pull remote"有什么区别?

我一直在使用'git pull origin'查看我朋友项目的更新,但我想知道我是否应该使用'git pull remote'来代替.

git pull git-pull

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