如何模糊图像?

我正在尝试在java游戏上实现模糊机制。 如何在运行时创建模糊效果?

Java,检查String是否是回文。 不区分大小写

我想编写一个java方法,如果字符串是回文,则返回true。 这是我到目前为止: String palindrome = “…”; boolean isPalindrome = palindrome.equals( new StringBuilder(palindrome).reverse().toString()); 我的问题在于它没有考虑这样一个词: Race car是一个回文。 Doc, note, I dissent. A fast never prevents a fatness. I diet on cod. 测试这是否是回文的最佳方法是什么,不区分大小写并忽略标点符号。

通过不同的线程访问变量和摆动组件

这个问题与我在这里问的问题有些关系。 现在,我有一个类“Controller”,它由main方法和所有swing组件组成。 有一个名为“VTOL”的类,它由一个名为“altitude”的变量组成(我现在已声明此变量为volatile)。 这是一个由在后台运行的线程组成的类: import java.util.logging.Level; import java.util.logging.Logger; /** * * @author Vineet */ public class Gravity extends Thread { String altStr; double alt; Controller ctrl = new Controller(); @Override public void run() { while (true) { alt=VTOL.altitude; System.out.println(alt); alt = alt-0.01; VTOL.altitude= (int) alt; altStr=new Integer(VTOL.altitude).toString(); ctrl.lblAltitude.setText(altStr); try { Thread.sleep(10); } catch (InterruptedException e) […]

我应该关闭StringReader吗?

我使用StringReader将字符串转换为可以上传到SFTP服务器的字符串(它需要一个流)。 之后关闭StringReader有什么意义吗? 据我所知,它只是将字符串设置为null … 我可以做到这一点,但是因为close方法被标记为抛出IOException并且所有我必须将它包装在try catch中并且代码最终看起来比它可能需要的更加可怕。

在Java中将ASCII代码转换为char

这是我下面的代码,它打印J = 74,A = 65,M = 77。 如何通过向下移动字母表来打印字符K,B,N? BufferedReader buff = new BufferedReader(new InputStreamReader(System.in)); String string = JOptionPane.showInputDialog( ” Please Enter Code ” ); for (int i = 0; i < string.length (); ++i) { char c = string.charAt(i); int j = (int)c; } System.out.println("ASCII OF "+c +" = " + j + ".");

Java:popen() – 喜欢什么function?

这是在本地处理程序的上下文中。 我想运行一个外部程序来获取一些数据。 我可以使用popen()或等效函数吗?

用于访问Vista和Win 7中的系统/主音量控件的Java Sound API

历史与现状: 我目前正在更新几年前为客户开发的Java应用程序(在WinXP上运行),用于测试和培训具有某些听力障碍的人。 购买此应用程序的用户可获得特定的USB声音设备和耳机。 该软件最重要的要求之一是音频必须以特定的分贝声级播放给用户。 使用Java Sound API,该应用程序被开发用于动态调整Windows Volume到计算的级别(基于在开发期间校准USB声音设备和耳机时所做的测量)。 问题: 现在需要升级该应用程序以支持Windows Vista和Windows 7,但是由于Windows的新应用程序声音架构,我无法找到使用Java Sound API访问Master / System卷的任何方法。 应用程序的Windows音量控制本身并没有削减它,因为它相对于系统音量,并且无法保证用户将听到特定的已知级别的输出音频。 有人知道是否有可能在Java中这样做,如果是,那么如何? 如果不可能,那么你能否就可能最简单的方法提供指导? (JNI和C也许 – 虽然我之前从未使用过JNI ……任何需要注意的问题?)

JComboBox返回值

用什么方法返回用户选择的选择? JPanel ageSelection = new JPanel(); JLabel age = new JLabel(“Age:”); ArrayList ageList = new ArrayList(); for (int i = 1; i <= 100; ++i) { ageList.add(i); } DefaultComboBoxModel modelAge = new DefaultComboBoxModel(); for (Integer i : ageList) { modelAge.addElement(i); } JComboBox ageEntries = new JComboBox(); ageEntries.setModel(modelAge); ageEntries.addActionListener(new putInTextListener()); ageSelection.add(age); ageSelection.add(ageEntries); class putInTextListener implements ActionListener […]

打开eclipse Markeplace

我想使用eclipse marketplace添加svn插件,但是当我尝试这样做时,我有这个例外: Cannot open Eclipse Marketplace Cannot install remote marketplace locations: Unable to read repository at marketplace.eclipse.org/catalogs/api/p. Unable to read repository at marketplace.eclipse.org/catalogs/api/p. sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target Unable to read repository at marketplace.eclipse.org/catalogs/api/p. sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification […]

RequestDispatcher是否在一个servlet容器中处理多个webapps?

RequestDispatcher是否可以处理多个Web应用程序? 我问,因为我有一个单一的webapp工作正常,使用RequestDispatcher而不是重定向,所以在显示错误和反馈消息时状态不会丢失。 但是我现在需要在两个webapps之间拆分一些function,因此初始调用是从webapp1上托管的网页进行的,调用webapp2最终将用户返回到webapp1上托管的页面。 显然,如果webapps和webapp2在不同的网站上使用RequestDispatcher是不可能的,但是如果两个webapps都部署在servlet容器的同一个实例中(tomcat 7) 更新 得到请求调度程序部分工作,如在答案中解释,但我无法检索放入我的webapp2中的数据,这是我使用它的原因 即 调用webapp2,进行一些处理,然后调度到webapp1上的jsp protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession userSession = request.getSession(true); String emailAddress = …… String nextPage = /finish.jsp userSession.setAttribute(“DATA”, emailAddress); ServletContext otherContext = getServletContext().getContext(“/webapp1”); otherContext.getRequestDispatcher(nextPage).forward(request, response); } webapp2 jsp文件包含 … Email() … 但始终显示null 更新2 ** 我想知道我是否误解了crossContext =“true”实际上是做什么的。 它是否可以在不同的webapps中使用相同的HttpSession,或者只是将ServletContext从一个webap可用到另一个webap,从而允许一个webapp看到另一个webapp的HttpSessions? 我开始认为我在做什么是一个坏主意,因为我一直热衷于使用vanilla servlet设置,并且从不想将自己绑定到特定的实现。 我想如果我解释为什么我首先需要拆分webapps,这可能会有所帮助。 我有一个webapp(webapp1),这是一个关于我开发的产品的网站,以及使用Google […]