首页 \ 问答 \ 在JButton中添加阴影效果[已关闭](Adding shadow effect in JButton [closed])

在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
更新时间:2022-04-26 20:04

最满意答案

用户数据存储指针,因此您需要动态分配内存。 尝试这样的事情:

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!

相关问答

更多
  • 也许你可以从一个可观察对象中创建一个流,然后在你的组件中订阅它,因此每次它改变你的组件都会相应地更新这个值: import { Injectable } from '@angular/core'; import {Subject} from 'rxjs/Subject'; @Injectable() export class ViewToggleService { leftVisible:boolean=true; // Observable boolean source private lef ...
  • 用户数据存储指针,因此您需要动态分配内存。 尝试这样的事情: 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."
  • (defun foo () (lambda-returning-expr)) (defvar bar (lambda-returning-expr)) 对于这两种情况你都需要funcall ,例如(funcall(foo))和(funcall bar) ,但是在(foo)中包含一个额外的函数调用,每次都会计算(lambda-returning-expr)每次都可以获得不同的功能。 如果你期望可能有不同的功能,那么使用像foo这样的函数将是适当的。 如果你期望只有一个,那么像bar这样的变量将是适当的。 ...
  • 我认为你想要研究的是加速度。 现在,您使用以下方法调整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 ...
  • 从不调用position函数。 你错过了代码中的parantheses: onLoad="position()" The position function is never called. You are missing the parantheses in the code: onLoad="position()"

相关文章

更多

最新问答

更多
  • h2元素推动其他h2和div。(h2 element pushing other h2 and div down. two divs, two headers, and they're wrapped within a parent div)
  • 创建一个功能(Create a function)
  • 我投了份简历,是电脑编程方面的学徒,面试时说要培训三个月,前面
  • PDO语句不显示获取的结果(PDOstatement not displaying fetched results)
  • Qt冻结循环的原因?(Qt freezing cause of the loop?)
  • TableView重复youtube-api结果(TableView Repeating youtube-api result)
  • 如何使用自由职业者帐户登录我的php网站?(How can I login into my php website using freelancer account? [closed])
  • SQL Server 2014版本支持的最大数据库数(Maximum number of databases supported by SQL Server 2014 editions)
  • 我如何获得DynamicJasper 3.1.2(或更高版本)的Maven仓库?(How do I get the maven repository for DynamicJasper 3.1.2 (or higher)?)
  • 以编程方式创建UITableView(Creating a UITableView Programmatically)
  • 如何打破按钮上的生命周期循环(How to break do-while loop on button)
  • C#使用EF访问MVC上的部分类的自定义属性(C# access custom attributes of a partial class on MVC with EF)
  • 如何获得facebook app的publish_stream权限?(How to get publish_stream permissions for facebook app?)
  • 如何防止调用冗余函数的postgres视图(how to prevent postgres views calling redundant functions)
  • Sql Server在欧洲获取当前日期时间(Sql Server get current date time in Europe)
  • 设置kotlin扩展名(Setting a kotlin extension)
  • 如何并排放置两个元件?(How to position two elements side by side?)
  • 如何在vim中启用python3?(How to enable python3 in vim?)
  • 在MySQL和/或多列中使用多个表用于Rails应用程序(Using multiple tables in MySQL and/or multiple columns for a Rails application)
  • 如何隐藏谷歌地图上的登录按钮?(How to hide the Sign in button from Google maps?)
  • Mysql左连接旋转90°表(Mysql Left join rotate 90° table)
  • dedecms如何安装?
  • 在哪儿学计算机最好?
  • 学php哪个的书 最好,本人菜鸟
  • 触摸时不要突出显示表格视图行(Do not highlight table view row when touched)
  • 如何覆盖错误堆栈getter(How to override Error stack getter)
  • 带有ImageMagick和许多图像的GIF动画(GIF animation with ImageMagick and many images)
  • USSD INTERFACE - > java web应用程序通信(USSD INTERFACE -> java web app communication)
  • 电脑高中毕业学习去哪里培训
  • 正则表达式验证SMTP响应(Regex to validate SMTP Responses)