我Circle在WPF窗户上画画.问题是我无法添加Text到Circle.代码如下:
public Graphics()
{
InitializeComponent();
StackPanel myStackPanel = new StackPanel();
Ellipse myel = new Ellipse();
SolidColorBrush mscb = new SolidColorBrush();
mscb.Color = Color.FromArgb(255, 255, 0, 0);
myel.Fill = mscb;
myel.StrokeThickness = 2;
myel.Stroke = Brushes.Black;
myel.Width = 100;
myel.Height = 100;
//string str = "hello";
myStackPanel.Children.Add(myel);
this.Content = myStackPanel;
}
Run Code Online (Sandbox Code Playgroud)
请帮助我这方面.
我在Spring启动应用程序中使用RedisTemplate,我可以使用singleKey读取.
String valueJson = (String) redisTemplate.opsForValue().get(setKey(someId));
Run Code Online (Sandbox Code Playgroud)
我现在有一个"someId"列表,如"List someIds",我想得到所有ID的数据.当然我可以在列表上进行迭代并使用单独的键点击redis,但我不想要那个,而是我想提供整个列表来一次性获得响应.
请帮忙.
我正在尝试从 Objects[] 列表中制作一个 Hashmap,但我无法这样做。下面是我写的代码:
List<Object[]> adjustments = query.getResultList();
Map<Integer, BigDecimal> dpaMap = adjustments.stream().collect(Collectors.toMap(a -> (Integer)a[0], a -> (BigDecimal)a[1]));
Run Code Online (Sandbox Code Playgroud)
我知道只有两个字段从查询中返回,它们具有与 Map 中提到的相同的类型,但它不起作用。请在这方面指导我。
提前致谢。
我是Java新手,我正在开发GUI.我面临的问题是我无法在文件处理中使用"readLine()"函数.intellisense没有认识到这种特殊的方法,但我已经看到了这种方法完美运行的代码.我在下面粘贴了我的代码.
try
{
Index ind= new Index();
File file1 = new File(ind.path);
File file2 = new File(file1.getAbsolutePath() + ".tmp");
FileWriter fw1 =new FileWriter(file1,true);
BufferedWriter bf1 = new BufferedWriter(fw1);
BufferedWriter bf2 = new BufferedWriter(new FileWriter(file2));
String line= null;
while((line = bf1.readLine()) != null)
{
String tline = line.trim();
if(tline.contains(inputVal))
{
continue;
}
else
{
bf2.write(line);
}
}
Run Code Online (Sandbox Code Playgroud)
希望有更好的回应.