在JButton中添加阴影效果[已关闭](Adding shadow effect in JButton [closed])
这是一个基本问题。 我想在我的JButton按钮中添加阴影。 我可以轻松地在javaFX中添加阴影,但在JButton中,我发现它很混乱。 有什么办法在使用javaFX(而不是javaFX 2)的JButton按钮中创建阴影效果?
Here is a basic question. I want to add shadow in my button of JButton. I can add shadow in javaFX easily, but in JButton i find it confusing. Is there any way to create shadow effect in a button of JButton using javaFX(not javaFX 2) ?
原文:https://stackoverflow.com/questions/40902967
最满意答案
用户数据存储指针,因此您需要动态分配内存。 尝试这样的事情:
float* nums = new float(2.3f); pSprite->setUserData((void*)nums); ... float* data = (float*)pSprite->getUserData(); printf("%f", *data); delete data;
通常,您创建一个包含要在sprite中存储的所有数据的结构。 如果您只想存储一个号码,这将有效。 无论哪种情况,请务必删除内存!
User data stores a pointer so you will want to dynamically allocate the memory. Try something like this:
float* nums = new float(2.3f); pSprite->setUserData((void*)nums); ... float* data = (float*)pSprite->getUserData(); printf("%f", *data); delete data;
Generally you create a struct that contains all of the data you want to store in the sprite. If you just wanted to store one number this will work. In either case make sure to delete the memory!
相关问答
更多-
TCP/IP模型是一个________。[2023-10-02]
a -
下列中不属于面向对象的编程语言的是?[2022-05-30]
a -
Angular 2:是否可以在动态组件中绑定一个var?(Angular 2: is it possible to bind a var in a Dynamic Component?)[2023-01-26]
也许你可以从一个可观察对象中创建一个流,然后在你的组件中订阅它,因此每次它改变你的组件都会相应地更新这个值: import { Injectable } from '@angular/core'; import {Subject} from 'rxjs/Subject'; @Injectable() export class ViewToggleService { leftVisible:boolean=true; // Observable boolean source private lef ... -
如何绑定精灵上的var(How to bind a var on a sprite)[2023-09-13]
用户数据存储指针,因此您需要动态分配内存。 尝试这样的事情: float* nums = new float(2.3f); pSprite->setUserData((void*)nums); ... float* data = (float*)pSprite->getUserData(); printf("%f", *data); delete data; 通常,您创建一个包含要在sprite中存储的所有数据的结构。 如果您只想存储一个号码,这将有效。 无论哪种情况,请务必删除内存! User d ... -
如果选择绑定变量并对其进行编辑(VO编辑器中的“查询”选项卡),则会出现“控制提示”选项卡。 尝试将显示提示从“显示”更改为“隐藏”。 If you select the bind variable and edit it (Query Tab in VO editor) there is a Control Hints tab. Try changing Display Hint from "Display" to "Hide."
-
绑定一个lambda到一个函数或一个var是否更符合语义?(Is it more semantically correct to bind a lambda to a function or a var?)[2023-10-19]
(defun foo () (lambda-returning-expr)) (defvar bar (lambda-returning-expr)) 对于这两种情况你都需要funcall ,例如(funcall(foo))和(funcall bar) ,但是在(foo)中包含一个额外的函数调用,每次都会计算(lambda-returning-expr)每次都可以获得不同的功能。 如果你期望可能有不同的功能,那么使用像foo这样的函数将是适当的。 如果你期望只有一个,那么像bar这样的变量将是适当的。 ... -
平衡一个精灵(Balancing a sprite)[2024-05-16]
我认为你想要研究的是加速度。 现在,您使用以下方法调整verlocityX的静态金额: if touchPosition.x < CGRectGetMidX(self.frame) { xVelocity = -75 } else { xVelocity = 75 } 这样做会导致你的生硬动作。 这实际上只是线性的。 使用加速可以避免这种情况。 为此,你需要两个更多的变量来实现maxVelocity和acceleration 。 您希望maxVelocity可能限制速度。 您需要使用加速量 ... -
可以使用多种不同的方法...... ng-if表达式中使用三元或者使用三元组,则可以使用其中两种方法{{ "Hello" + userInput}}要么{{userInput ? "Hello" + userInput :''}}Can use numerous different approaches ... ng-if or use a ternary in expression are two of them ...
-
鉴于您的目标是实现ES2015的Node.js,您最好使用箭头功能。 箭头函数具有所谓的词法 ,这意味着箭头函数中的变量被视为正常变量,并在您创建函数时关闭 。 所以你的代码变成: retval.then((argument) => { console.log("argument"+JSON.stringify(argument)); // "this" will inherit the value of the outside scope this.stateSetting(arg ...
-
移动精灵(Moving a sprite)[2024-02-20]
从不调用position函数。 你错过了代码中的parantheses: onLoad="position()" The position function is never called. You are missing the parantheses in the code: onLoad="position()"